Rav Alex Israel - www.alexisrael.org
The Torah Song
"Now, write down this song and teach it to the people of Israel; put it in their mouths, in order that this poem may be My witness against the people of Israel."(31:19)
The Sefer Hachinuch lists this passuk as the source for the final Mitzva of the 613 mitzvot in the Torah. It is the Mitzva to write a Sefer Torah. Is that the true meaning of this verse? After all doesn't the Torah refer to a song or a poem – "shira" rather than the writing of the entire Torah? Why is this verse interpreted by the Rabbis as a Mitzva to write a Sefer Torah?
1. Devarim 31:14-24.
How does verse 19 and 22 (that discuss "shira") relate to the notion of "Sefer Torah" in verse 24? See also v.9 and 32:44
In other words, what has Moshe written here?
2. Rashi, Rashbam, Ramban on 31:19.
I have found the achronim to be most interesting here: Torah Temima, Hirsch, HaEmek Davar, HakTav Vehakabbala..
3. The Gemara in Eruvin 54b (wide lines) in a famous piece about the transmission of Torah Sheb'al Peh uses this passuk to teach us about teaching methodology for Torah… even to the extent of using "simanim," clues and memory aids. ("siman" being Rav Hisda's pun on the phrase "sima bephihem!")
Rambam Hil. Tefillin, Mezuzah and Sefer Torah 7:1
Shulkhan Aruch. Yoreh Deah. Siman 170.
Shiur Part 1 – What is "The Song?"
THEORY A : THE SONG = HAAZINU
What was the song that Moshe was required to write down and to teach to Bnei Yisrael? Both Rashi and Ramban tell us that it refers to Shirat Haazinu, the poem that appears in the following Chapter – Devarim ch.32.
This is supported by the concluding line to Shirat Haazinu:
"Moses came, together with Hoshea bin Nun and recited the words of this poem (shira) in the audience of Bnei Yisrael" (32:44)
This would appear to be a direct fulfilment of the verse in which BOTH Moshe AND Yehoshua are addressed in the Ohel Moed and instructed:
"Now, you (2nd person plural) write down this song/poem (shira) and teach it to the people of Israel; put it in their mouths, in order that this poem may be My witness against the people of Israel."(31:19)
Rashi and Ramban have full support for their position. Indeed it makes sense that Shirat Haazinu be committed to the collective national memory. The Shira talks about the dangers of national complacency in periods of comfort and tranquillity. It warns of the dangers of assimilation and idolatry and the destruction and national failure that will ensue if Israel deserts God. This prediction and warning of potential national ruin would seem to be an apt message to the "stiff-necked people."
PUTTING IT IN CONTEXT
If the Mitzva here is to write and memorise Shirat Haazinu, then we need to comprehend its mission, its message. The Malbim in a beautiful piece of d'rash, puts the writing of Shirat Haazinu into its wider context here in the Parsha. After all, why are we told to write down this Parsha? The verses inform us:
"The Lord said to Moses: You are soon to lie with your fathers. This people will go astray after alien gods in their midst, in the land that they are about to enter; they will forsake Me and break my covenant that I made with them. Then my anger will flare up against them and I will abandon them and hide my face from them. They shall be ready prey; and many evils and troubles shall befall them … therefore, write down this song and teach it to the children of Israel… that this song be for Me a witness regarding the children of Israel." (31:16-19)
The Malbim comments:
"This can be appropriately explained by means of a parable: A king freed a slave from jail appointing him as responsible for his royal treasury. The king knew that this man had a long history as a thief. He also understood that he probably would not change this side of his character, the likelihood being that at some point, he would steal from the king, incurring his own death sentence. However, the king didn't want the man to die. And so, he recorded the entire episode in his royal archive; that the man was an incurable thief and that he himself had approved the appointment with full knowledge. Anyone who read the entry in the royal records thought that the purpose of the record was to deter and warn the thief that of he stole he would be severely punished. But in truth, it was a reminder for the king himself, that in the eventuality that the thief might commit the crime, the king would treat him lightly. After all he knew that the man was a thief and that he selected him.
Similarly here; God says: I know that they will sin in the future, and therefore, WRITE DOWN THIS SONG for your own good. TEACH IT TO THE CHILDREN OF ISRAEL, MEMORISE IT, let it be in your memory, on the tips of your tongues as an excuse, an explanation to Me so that you not be punished IN ORDER THAT THIS SONG BE A TESTIMONY FOR ME REGARDING BNEI YISRAEL – this will testify as to their exemption from punishment."
This is a very unusual reading, but it has a certain charm as it turns all the sinister foreboding of Shirat Haazinu on its head! For the Malbim, when the Torah states: "It should be for you as a witness", it does not mean to say that it shall be a witness for the prosecution, but a witness for the defence! This is not just another terrible warning that Am Yisrael shall sin; it is a reminder to God that he chose us in spite of our faults and our waywardness.
Now if Moses is instructed to write Shirat Haazinu there will be no Mitzva of writing a Sefer Torah. Indeed this is the opinion of certain Rishonim. The Mitzva is simply for Moshe to write Haazinu.
And yet, the majority of Halakhic authorities do list this verse as the source for writing down the entire Torah! One wonders why they see this verse as a prooftext.
The RAMBAM resolves the clash between p'shat and Halakha in an interesting way.
"It is a Positive Commandment incumbent upon every man of Israel to write for himself a Sefer Torah, as it states: Now write for you this song. That is to say, write the Torah which contains this song since we do not write individual parshiot of the Torah." 
The Rambam's methodology here is interesting. The real Mitzva is to write Shirat Haazinu. However, the Halakha mandates that the Torah not be written other than as an organic entity, a single unit. In other words, the writing of the entire Torah is mandated in order to facilitate the Mitzva of writing Shirat Haazinu. 
[This rather convoluted methodology of the Rambam was once given a deeper meaning by my Rosh Yeshiva, Rav Amital shlita . In a "drasha" at Seuda Shlishit 5749, Rav Amital presented the following idea, which in a sense is quite radical. Rav Amital asserted that Shirat Haazinu essentially represents a study in History. "Remember world history, consider the fluctuations of generations; discuss it with your father and he shall inform you, your elder and he shall tell you." (32:7) If we follow the Rambam's logic, the entire Torah is being written in order to facilitate a text that interprets Jewish history, a key to decoding the past and future. What does this mean?
Rav Amital posited that History and Torah are integrally connected. Without an understanding of our Historical situation, one can misread and misapply the entire Torah! The Torah rests upon Shirat Haazinu in order to tell us that a Torah divorced from the needs and context of its time, cannot be correct. And the converse us true as well. Rav Amital critiqued those who divorce our national History from Judaism seeing the course of Medinat Yisrael as a political secular process with no connection to God.]
THEORY B – THE SONG =THE ENTIRE TORAH
However, there is a second school of commentators that prefer to see the command to write a Sefer Torah as flowing more naturally from the text itself. The "shira" under discussion is the ENTIRE TORAH. How might this work? After all, the Torah uses the phrase "shira!" What might this term imply?
1. The Netziv
"In Massechet Nedarim 38 it is suggested that the phrase "shira" as in "Write down this song" applies to the entire Torah…. How may the entire Torah be compared to song or poetry, after all it is not written in poetic style. Rather we must suggest that Torah as a whole contains the inner qualities of poetry in that poetry uses language in a unique way. Everyone knows that poetry differs from prose in that the ideas are not explicitly expressed, as in prose. In poetry one needs a commentary alongside the poem to say: "this stanza refers to this or that." This is not an external addition to the text, but this is the very nature of poetry, even for the layman. Moreover, in poetry, an expert, one who understands the allusion and the choice of phrase, will be enlightened by the language and style of the poem in a way radically different to a person who simply wishes to know the basic theme of the poem. In fact that person, ignorant in poetry, will probably emerge misunderstanding the intent of the poet. Such is the nature of Torah. The stories are not explicitly interpreted and laid out before the reader. Rather one has to create a commentary that dwells upon the allusions, the precision of language … maybe alluding to a particular law, a teaching or a midrash." (HaEmek Davar. Introduction to Torah sect.3)
2. Torah Temimma
One might suggest a different approach that puts the phrase "shira" in a more textual (p'shat) framework. Look at the parsha. Verse 9 talks about Moshe writing the Torah:
"9 And Moses wrote this law, and delivered it unto the priests the sons of Levi…"
Verse 19 has God instructing Moshe to write down this "song" as a testimony and witness to the nation:
19 Now therefore write ye this song for you, and teach thou it the children of Israel; put it in their mouths, that this song may be a witness for Me against the children of Israel.
And then in verse 22, 26 and 30 we are told that Moses completes the Torah. 
22 So Moses wrote this song the same day, and taught it the children of Israel. 23 And he gave Joshua the son of Nun a charge, and said: 'Be strong and of good courage; for thou shalt bring the children of Israel into the land which I swore unto them; and I will be with thee.' 24 And it came to pass, when Moses had made an end of writing the words of this law in a book, until they were finished, 25 that Moses commanded the Levites, that bore the ark of the covenant of the LORD, saying: 26 'Take this book of the law,
There is certainly some ambiguity here. Is Moses writing the Law or the Song?
Two options come to mind. The first is that the word "shira" is simply a synonym for "Torah." Then, the verses flow smoothly. The conclusion being that the verses are discussing a single creation; the Torah Shebichtav.
Alternatively, we might suggest that this song is indeed Shirat Haazinu, but that effectively it completes the Torah. The Torah Temima follows this second approach:
"This works according to the theory posited in Talmud Gittin 60b that the Torah was written in successive instalments i.e. whenever Moses was transmitted a particular parsha, he would write it down, until the end of the forty wilderness years. Now, when he comes to write Shirat Haazinu, and God tells him that his death is imminent, the Torah adds that "now" i.e. now that all the sections are complete write this down and complete it. Now that the Torah is complete, "teach it to the People of Israel." Hence, the essence of this Mitzva is the writing of the entire Torah."
The Torah Temmima is discussing the precise moment in which Chumash was written. He follows a tradition that the Torah was transmitted in instalments. Apparently, this Shira is the final instalment of Torah. With that final jigsaw piece, the 5 Books of the Torah are now complete and whole.