When David had made an end of offering the burnt offering and the peace-offerings, he blessed the people in the name of Yahweh.
So David gave him the lyrics, and these guys started singing and worshipping the Lord with this song or psalm.