@opusdei1972
A horrible thought, no matter how you read it, that verse is the end of a song lamenting what the Babylonians did to the Jews and their own children in the process.
Many Jewish infants died in the siege and deportation to Babylon. To top things off, once in captivity, the Babylonians further taunted the Jews to continue with their liturgical actions of thanksgiving that once filled the First Temple.
While the Jews felt they could not offer songs of thanksgiving, they did make up a song to sing about Babylon starting in the verse before the one you quote:
"A blessing on him who repays you in kind/what you have inflicted on us;/a blessing on him who seizes your babies/and dashes them against the rocks!"
In other words: "The only song we will sing to you is that we will bless those who do to you what you did to us, who will do to your children what you did to ours!"
The text isn't advising people to seek vengeance but describing how painful it was for the Jews to endure captivity and taunts.