The title of this Psalm in my Bible is "Prayer of a Suffering Sinner."
It was common thought in these days that if you were suffering it was because of sin in your life. Job's friends were quick to tell him he was a sinner and needed to confess. The Jesus' disciples asked "1Rabbi, who sinned, 2this man or his 3parents, that he would be born blind ?" (John 9:2)
But Jesus explained that not all suffering is because of sin. 3 Jesus answered, "It was neither that this man sinned, nor his parents; but it was so 4that the works of God might be displayed in him."
That being said, the man in this Psalm WAS a sinner. He knew that his problems and suffering were because God was punishing him for his sin. Too often in America these days we make excuses for sin. We ignore the consequences of sin. We dismiss our own suffering and claim it has nothing to do with sin. We like to quote all of the "God is love" verses and ignore the ones where He says that He hates sin, pride, rebellion, etc.
So I think the thing to take away from this Psalm is that it is important to admit sin, to ask for forgiveness and admit our guilt. We have this promise.
If we confess our sins, He is faithful and righteous to forgive us our sins and to cleanse us from all unrighteousness. 1 John 1:9 NASB