syntax error with awk.

A shell script a.sh calls an awk script using :
awk -v OUTPUTDIR=${OUTPUTDIR}${OUTPUTDIRDATE} -f ${SCRIPTSPATH}chngNullBillId.awk ${INPUTFILE}

chngNullBillId.awk :
{ if (substr($0,9,4)=="0000") printf( "%s0001%s", substr($0,1,8), substr($0,13,67) )>>${OUTPUTDIR}"goodfile.txt";
else print $0>>${OUTPUTDIR}"goodfile.txt";
}

Awk script does :
picks characters from 9-12, if 0000 then changes it to 0001 and writes out the full LINE goodfile.txt
Else if characters from 9-12 are not 0000 then writes the entire line to goodfile.txt

When I try to execute the script, I get the followinf error :
Syntax Error The source line is 1.
The error context is
{ if (substr($0,9,4)=="0000") printf( "%s0001%s", substr($0,1,8), substr($0,13,67) >>> )>>${ <<<
awk: 0602-502 The statement cannot be correctly parsed. The source line is 1.
Syntax Error The source line is 2.
:confused:
Please guide.
Thanks
Amruta

Try

{

 if (substr($0,9,4)=="0000") 
    printf( "%s0001%s", substr($0,1,8), substr($0,13,67) )>>OUTPUTDIR"goodfile.txt"
else 
   print $0>>OUTPUTDIR"goodfile.txt"
}

regards

Hello Klashxx,
This worked.

Thanks