As a righteous king, David wanted to instill praise in his people’s hearts. What a good leader! First he taught the people whom to praise (the Lord) and then why they should praise him (because he is good, and his love lasts forever). And he gave them the words to say.
Remember that praise always begins with a heart of thankfulness—not just for what God has done but also for who he is. He is worthy of praise because he alone is good (see Mark 10:18), and he alone is capable of loving us forever.