The flow of this psalm is one where the author cries out to the Lord for help, look at vs.1 and then the transition happens in vs.6 where we hear that God has heard the his pleadings and responded to his cries. You can follow from vss. 1-2 a beseeching from the author that is gutfelt and has deep emotional ties with commands: “do not refuse to hear me”, “hear the voice of my supplication”.
This then transitions to a celebration that the Lord has listened and so as a result I am helped. To recognize that we are helped by God can only produce a heart which exults and a song of thanksgiving.