How to minus 2 month from current date?

I am running a script in ksh to get the 2 months back date from system date.The below code is giving correct date output from putty command prompt.But while running the script is .ksh file it is giving the error below.Please suggest.

[#!/bin/ksh
newdate=$(echo 2 | awk -v date="$(date "+%m %d %Y")" -v OFS="/" '
{num=$0 
split(date, a); m=a[1]; d=a[2]; y=a[3]
m-=num
while(m < 1) {m+=12; y--}
printf("%02d%s%02d%s%s\n", m, OFS, d, OFS, y)}')
echo "\$\$FROMDATE="$newdate > /usr/local/infadev/LkpFiles/EXT_CROSS_REF_weekly_param.txt

exit 0]
error:

/usr/local/infadev[instipcd] > ksh -x test.ksh
+ + echo 2
+ date +%m %d %Y
+ awk -v date=03 27 2014 -v OFS=/
{num=$0
split(date, a); m=a[1]; d=a[2]; y=a[3]
m-=num
while(m < 1) {m+=12; y--}
printf("%02d%s%02d%s%s\n", m, OFS, d, OFS, y)}
 Syntax Error The source line is 1.
 The error context is
 <<<             >>>
 awk: 0602-500 Quitting The source line is 1.
newdate=
+ echo $$FROMDATE=
+ 1> /usr/local/infadev/LkpFiles/EXT_CROSS_REF_weekly_param.txt
+
test.ksh[9]: ^M:  not found.
+ exit 0 

If this is Homework, then you are to comply with the special rules here, like filling the given template...
Thread closed!