Getting error as : Syntax error: unexpected end of line..on calling bteq inside shell script

Tools
Fan

Getting error as : Syntax error: unexpected end of line..on calling bteq inside shell script

Hi All, 
 
I need to write Unox shell script. To start with : I need to do some file checking on unix file system, Then Based on file existence,
I need to run diff sql in teradata bteq. After that , depending on query result of sql, I need to code other shell scripting.
 
My script look like this:
 
Step 1 : Some Unix command
Step 2 : Other Unix Command
Step 3 : Bteq Login
Step 4 : Teradata sql
Step 5 : Bteq Logoff
Step 6 : Unix Command
And so on..

I am posting here my small code snippet here,But getting error as:
 
Output: Syntax error: unexpected end of line..
However, If execute my shell script and bteq those executed successfully.
But when i am trying to call bteq batch inside my script getting error.
Please help me on this situation:

Code:
 
# Main Body of this Script
BTEQ_NAME_LIST=BTEQ.txt

for i in `cat ${BTEQ_NAME_LIST}` ; do
BTEQ_NAME=`echo "${i}" | awk -F"|" '{ print $1 }'`;
export BTEQ_NAME;
 
BTEQ_PARAM_FILE=`awk '{for(i=1;i<=NF;i++)if($i~/\/bin/)print $(i)}' $BTEQ_NAME|cut -d"/" -f8|cut -d";" -f1`
 
awk '{for(i=1;i<=NF;i++)if($i~/\=/)print $(i)}' $BTEQ_PARAM_FILE|cut -d"=" -f1 > ParamP1.txt
 
awk '{for(i=1;i<=NF;i++)if($i~/_/)print $(i)}' ParamP1.txt > Param.txt
 
#rm ParamP1.txt
 
     conn_string=`ksh /apps/cronacle/tools/teradata/.otherdetails/ .Info_4ETL.sh UID_ODS_CLP_DRG`
     export conn_string;
     bteq <<[Test]
     .logon ${conn_string};
     .export report FILE = /ftp/SrcFiles/src/SSSS/sample.txt;
     .SET SEPARATOR '|'
     SELECT * FROM dbc.tables where tablename='AP_INVC_F_V';
     .logoff
     .quit
     [Test]
 
#rm Param.txt
 
done