The children of the Levites bore the ark of God on their shoulders with the poles thereon, as Moses commanded according to the word of Yahweh.
So David gave him the lyrics, and these guys started singing and worshipping the Lord with this song or psalm.