Jerusalem’s end would be different from the end of her enemies. Her punishment would end (her sins forgiven), but Edom’s sins would not be forgiven and she would not be restored. God is like a father who punishes his child, but who will not allow other children to come and stand around and gloat over the punishment.
Jeremiah puts his faith in the promises of God that he would judge the nations and restore Israel. For this reason, his song ends in hope. His people’s punishment would have an end. Looking back, we can see how God eventually led his people out of exile and back to Jerusalem. We also see how he eventually let his Messiah come forth from them—under whose shadow we can live today (verse 20).
22 The punishment of your iniquity, O daughter of Zion, is accomplished; he will keep you in exile no longer; but your iniquity, O daughter of Edom, he will punish; he will uncover your sins.