From Neil Short’s Does God create the wicked for trouble:
What does Proverbs 16:4 actually say?
The Hebrew verb often translated “has made” (RSV, NRSV, ESV, NASB, KJV, ASV) can also be translated as “works out” (NIV, NCV, NET). The word translated as “purpose” can also be translated as “answer.” Thus, the meaning of the verse is that God works things out so that the end of the wicked properly answers their wickedness. As a bonus, that reading appreciates Proverbs 16:4 as a proper proverb. The NIV has the best reading of this verse:
The LORD works out everything for his own ends―even the wicked for a day of disaster (NIV).
Let us not ignore the plain translation of the International Children’s Bible:
The Lord makes everything work the way he wants it. He even has a day of disaster for evil people (ICB).