וַיִּכְתֹּ֥ב מֹשֶׁ֛ה אֶת־הַשִּׁירָ֥ה הַזֹּ֖את בַּיּ֣וֹם הַה֑וּא וַֽיְלַמְּדָ֖הּ אֶת־בְּנֵ֥י יִשְׂרָאֵֽל׃
So Moses wrote this song the same day, and taught it the children of Israel.
Read halakhic rulings (Jewish law) on Deuteronomy 31:22: and classical halakhic sources.