proble in ftp script

i had written one script
that make connection with remote host
get some file and close the connection ..
it works fine .. but when i put this scrip in between control structure commands like "if , case " then it give me error like" syntax error at line 26 : `<<' unmatched"

please tell me can we use automated ftp script in control structure
my script is

Oms_host=$1
oms_login=$2
oms_pass=$3
oms_installation_location=$4


JAR_FILE1=omsconnectors-src.jar
JAR_FILE2=omsconnectors.jar
JAR_FILE3=oms_api.jar


CSV_FILE1=ExternalCreditCheck.csv
CSV_FILE2=GetAddressById.csv
CSV_FILE3=InternalCreditCheck.csv
CSV_FILE4=GetCustomerInfo.csv


echo " INPUT oms host   ${Oms_host} oms login ${oms_login} oms pass ${oms_pass}"
echo " oms_installation_location == ${oms_installation_location}"
echo " INPUT oms host   ${Oms_host} oms login ${oms_login} oms pass ${oms_pass}"


check=Y
if [[${check}= Y]]
       then
         ftp -n ${Oms_host} << EOT
                        user ${oms_login} ${oms_pass}
                        cd ${oms_installation_location}/omsserver
                        get apm.xml
                        cd ..
                        cd AMSS_Configuration
                        get ${JAR_FILE1}
                        get ${JAR_FILE2}
                        cd weblogic
                        get ${JAR_FILE3}
                        bye
                        EOT
       else 
         echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"       
   fi

Try:

ftp -n ${Oms_host} <<-EOF
user ${oms_login} ${oms_pass}
cd ${oms_installation_location}/omsserver
get apm.xml
cd ..
cd AMSS_Configuration
get ${JAR_FILE1}
get ${JAR_FILE2}
cd weblogic
get ${JAR_FILE3}
bye
EOF

thanks for your reply ..
but if i put this script in a control structure block
i mean in (IF ELSE )block ..it does not work

it gives me such error
"syntax error at line 25 : `<<' unmatched"

please help

[[${check}= Y]]

Should be

[[ ${check} = Y ]]

Thanks for reply, but this is not a correct reason
Even you put automated ftp script in a function it gives same error

Remove the tab/space characters that you have in the script before the second EOT.

if [[ ${check} = Y ]]
       then
         ftp -n ${Oms_host} << EOT
                        user ${oms_login} ${oms_pass}
                        cd ${oms_installation_location}/omsserver
                        get apm.xml
                        cd ..
                        cd AMSS_Configuration
                        get ${JAR_FILE1}
                        get ${JAR_FILE2}
                        cd weblogic
                        get ${JAR_FILE3}
                        bye
EOT
       else 
         echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"       
   fi

Thanks blowtorch ,

now its working ... ones again thanks for your reply

I have one more related problem. Hope you will help me.
Scenario is like this
I have one main script, that works fine ... but when I copied this automated ftp script code in my main script
My main script exited after execution of this ftp code ..