Do what is right and good in the LORD's sight, so that it may go well with you and you may go in and take over the good land that the LORD promised on oath to your forefathers. (Deuteronomy 6:18)
Why is it so important to do what is right and good in the Lord's sight? Moses, here says that, it is intimately related to your wellbeing and the Lord's promise being fulfilled in your life.
Regarding a couple of kings of Judah, the Bible says,
Asa did what was good and right in the eyes of the LORD his God.(2 Chronicles 14:2)
This is what Hezekiah did throughout Judah, doing what was good and right and faithful before the LORD his God.(2 Chronicles 31:20)
All the years that these kings did good and right, the Lord blessed them abundantly, rescued them from their enemies and gave them peace. But later on when they did wrong and did not trust in God, they paid the price for it.
In his latter years as king, Asa chose to befriend a wicked king and God sent a prophet to him who said,
"For the eyes of the LORD range throughout the earth to strengthen those whose hearts are fully committed to him. You have done a foolish thing, and from now on you will be at war."
King Hezekiah did an foolish thing of showing off all his treasures and riches to the envoys of a wicked Babylonian king and God had this to say to him,
The time will surely come when everything in your palace, and all that your fathers have stored up until this day, will be carried off to Babylon. Nothing will be left, says the LORD.(2 Kings 20:17)
The Apostle Paul, writing to the Philippians exhorts them in this manner:
Finally, brothers, whatever is true, whatever is noble, whatever is right, whatever is pure, whatever is lovely, whatever is admirable--if anything is excellent or praiseworthy--think about such things. (Philippians 4:8)
To the Church at Thessalonica, he again writes,
And as for you, brothers, never tire of doing what is right.(2 Thessalonians 3:13)
Surely, doing good and right is a pleasant sacrifice in the sight of the Lord and his blessings will be upon them that do so.