“Turn away from evil and do good; so shall you dwell forever. For the Lord loves justice; he will not forsake his saints. They are preserved forever, but the children of the wicked shall be cut off. The righteous shall inherit the land and dwell upon it forever.” -Psalm 37:27–29
Though the translation softens the language, there are actually three imperative verbs in verse 27: turn, do, and dwell. Since imperative verbs are commands to obey, there are promises associated with them, namely that the Lord will preserve his saints who obey him and not forsake them. He will give to the obedient the land for an eternal inheritance.
The command to turn away from evil reminds us how merciful the Lord is to forgive and bless the repentant. The command to do good is a command to be active in the work of cultivating the common good in the land. It is not enough to simply stop doing wrong, but one who is truly in alliance with the Lord will also love justice and naturally seek the common good of his neighbor. So shall you dwell is not an effect of turning from evil and doing good. It is a third command to maintain such a perspective and disposition.
In other words, the constant state of being of the believer is repentance and good works. This is the key to the righteous inheriting the land and dwelling up on it forever. In Christ, Paul echoed similar when he wrote,
“Therefore, having put away falsehood, let each one of you speak the truth with his neighbor, for we are members one of another. Be angry and do not sin; do not let the sun go down on your anger, and give no opportunity to the devil. Let the thief no longer steal, but rather let him labor, doing honest work with his own hands, so that he may have something to share with anyone in need.” -Ephesians 4:25–28