to offer burnt offerings to Yahweh on the altar of burnt offering continually morning and evening, even according to all that is written in the law of Yahweh, which he commanded to Israel;
So David gave him the lyrics, and these guys started singing and worshipping the Lord with this song or psalm.