Yahweh told Moses to write a song and teach it to the people so that the song could be a witness for Yahweh against the people of Israel.