seems like you're using ksh - make sure you specify the interpreter at the top of the file.
Also be careful copy/pasting the code and indent the code appropriately.
There's no need for 'ls ATK*.dat' - this is UUOL [Useless Use Of Ls].
Here's something to try:
Code:
#!/bin/ksh
#set -x
#file='ATK_7B1_WIP_20051116160700.9.xml.dat'
#for FILE in "${file}"
for FILE in ATK*.dat
do
curr_year=$(date +%Y)
curr_month=$(date +%Y%m)
#curr_month=200412 #<just for example>
file_year=$(echo ${FILE} | sed -e 's/.*_\([^_]\{4,4\}\).*/\1/g')
file_month=$(echo ${FILE} | sed -e 's/.*_\([^_]\{6,6\}\).*/\1/g')
if (( $curr_year == $file_year ))
then
if (( ($curr_month - $file_month) >= 3 ))
then
mv $FILE /u006/r45647/
echo "this $FILE moved to r45647 directory"
fi
else
echo 'please make sure all file names'
fi
done;