“I acknowledged my sin to you, and I did not cover my iniquity; I said, “I will confess my transgressions to the Lord,” and you forgave the iniquity of my sin. Selah” -Psalm 32:5
After holding back from God and suffering the inner turmoil of a heavy conscience (and possibly physical maladies related to his heavy heart), David confessed to the Lord; he made a full acknowledgment of his sin. For this is what confession means: to agree fully with God.
The fact that he did not “cover his iniquity” means he did not excuse his evil doings. He did not claim extenuating circumstances or try in any way to misrepresent or color his sinful behavior. With an open mouth—“I said”—he made an honest confession of his sins and the Lord forgave him.
This is why David will say in another Psalm, “If I had cherished iniquity in my heart, the Lord would not have listened.” -Psalm 66:18
And this is why the Apostle John tells his followers, “If we confess our sins, he is faithful and just to forgive us our sins and to cleanse us from all unrighteousness. If we say we have not sinned, we make him a liar, and his word is not in us.” -1 John 1:9–10