David assembled all Israel at Jerusalem, to bring up the ark of Yahweh to its place, which he had prepared for it.
So David gave him the lyrics, and these guys started singing and worshipping the Lord with this song or psalm.