In the previous verse to the one which you quote, Jeremiah says :
Remember that I stood before thee to speak good for them, to turn away thy wrath from them. [Jeremiah 18:20, KJV.]
In the previous eighteen chapters, Jeremiah has recounted the repeated warnings of God, through the prophet, to Judah. All of it has been resisted.
Again and again, the Lord remonstrates, by the prophet, with a disobedient and idolatrous nation to turn from their ways. And all of it is refused.
Finally, the tone changes. And inevitable judgment is the only possible consequence.
Everything possible had already been done to save Judah. Every attempt had already been made to show mercy. All was rejected.
Now, only now, Jeremiah cries to the Lord for a righteous end to this state of affairs.
What more grace could have been shown ?
What greater pity could have been expressed ?
But, in the end, righteousness must go forth and judgment must fall.
Should we pray for such things ? Well, are we called, by God himself, to prophecy to a whole nation ? Are we prophets who can pray and the rain will stop falling (see Elijah) ? And pray again and it starts again ? Do we have the discernment to know when a whole nation deserves a prayer of mercy or a prayer of judgment ?
It depends who 'we' are, I would say.