1)
What is the meaning of "Rak Lema'an Da'as"?
1.
Rashi: It was only to teach the later generations the result of sin. Now they will need to learn war!
2)
What is "l'Fanim"?
1.
Rashi: Before, when they served Hashem, they did not know these wars or strategies; they did not need them. Radak - Hashem fought for them; one Yisrael chased 1000 of them (Yehoshua 23:10). 1
1
Malbim: This is like it says "b'Azneinu Shamanu... Lo v'Charbam Yarshu Aretz" (Tehilim 44:2,4).