Surely you desire truth in the inner parts;
you teach me wisdom in the inmost place.
This Psalm started out with David crying out to God. After that first verse, the focus began to shift. Starting out with God, then that he sinned against God, then that he has always been a sinner, and now to the core of the sin problem.
David realizes that the sins that he committed were an outward fruit of an inward problem. If there is going to be any real change, it must start within. It must be a work of God.
If you are allowing sin to dwell in the heart, it will show itself eventually. But you don't have to wait. Cry out to God for mercy today.