Variable 1:'file:'$AI_SERIAL_LOOKUP'/GDFS_Off_Peak_Lkp.txt''file:'$AI_SERIAL_LOOKUP'/mssu2_massched.mssulrm_lkup_'$AI_PHASE'.txt''file:'${AI_SERIAL_TEMP}Variable 2:$PRIVATE_SCRIPT/2_ctc_rpt_dds_extn_stage_load.ksh ${AI_SERIAL}/${AB_JOB}_dds_parm_extn_iri_ctc_rpt.dat _${DestType} ${CURR_TIME_STAMP}$PRIVATE_SCRIPT/1_ctc_rpt_dds_extn_stage_to_base.ksh ${AI_SERIAL}/${AB_JOB}_ ${DestType} ${CURR_TIME_STAMP}Variable 3:TGDM01.T3113_DA_DLVR_SP a,TGIDM01.T3121_RT_REQ_CHK bTGIM01.T3121_RPT_RQ_CHKI need to print/export variable 1,2,3 side by side column wise in a Microsoft Excel sheet. 
Echo variable columnwise
linux
The easiest to generate a file understood by Microsoft Excel is to use a CSV format as it's just text with a simple format. In the standard format, rows are newline delimited, cells are comma separated, with double quotes being used to quote fields that contain problematic characters like comma and newline, and where a double character itself is entered as a .One thing that the CSV file format doesn't specify is the character set being used in the text of the file. That has to be communicated via other means.Variable content as single cellTo output a CSV row with those 3 variables, all we need to do is:escape the  characters within the variableswrap that in double quotesjoin them with commasadd a newline character.The printf builtin of the ksh93 shell, as the %#q format to output a string as a CSV field, so takes care of the first two points above for those values that need to be quoted. So in that shell, it's just: printf '%#q,%#q,%#q\n' $var1 $var2 $var3With bash/zsh/ksh, you can do that encoding by hand and quote every cell with: printf '%s,%s,%s\n' ${var1//\/\\} ${var2//\/\\} ${var3//\/\\}POSIXly, you could use awk to do the encoding:awk '  BEGIN {    for(i = 1; i < ARGC; i++) {      gsub(//, \\, ARGV[i])      printf %s\%s\, sep, ARGV[i]      sep = ,    }    printf \n  }' $var1 $var2 $var3 > file.csvOn your input, all those give:'file:'$AI_SERIAL_LOOKUP'/GDFS_Off_Peak_Lkp.txt''file:'$AI_SERIAL_LOOKUP'/mssu2_massched.mssulrm_lkup_'$AI_PHASE'.txt''file:'${AI_SERIAL_TEMP},$PRIVATE_SCRIPT/2_ctc_rpt_dds_extn_stage_load.ksh ${AI_SERIAL}/${AB_JOB}_dds_parm_extn_iri_ctc_rpt.dat _${DestType} ${CURR_TIME_STAMP}$PRIVATE_SCRIPT/1_ctc_rpt_dds_extn_stage_to_base.ksh ${AI_SERIAL}/${AB_JOB}_ ${DestType} ${CURR_TIME_STAMP},TGDM01.T3113_DA_DLVR_SP a,TGIDM01.T3121_RT_REQ_CHK bTGIM01.T3121_RPT_RQ_CHKEach line of each variable as a spreadsheet cellThat gets more complicated as you also need to split the variables into its lines.With ksh93 and its %#q format:IFS=while  found=false  read -ru3 a && found=true  read -ru4 b && found=true  read -ru5 c || $founddo  printf '%#q,%#q,%#q\n' $a $b $cdone 3<<< $var1 4<<< $var2 5<<< $var3 > file.csvWith bash/zsh/ksh, you could also use paste to paste 3 streams consisting of the expansion of the variables where the  have been escaped:paste -d ',' - <(printf '%s\n' ${var1//\/\\}) - \               - <(printf '%s\n' ${var2//\/\\}) - \               - <(printf '%s\n' ${var3//\/\\}) - < /dev/null > file.csvwhich on your input would give:'file:'$AI_SERIAL_LOOKUP'/GDFS_Off_Peak_Lkp.txt',$PRIVATE_SCRIPT/2_ctc_rpt_dds_extn_stage_load.ksh ${AI_SERIAL}/${AB_JOB}_dds_parm_extn_iri_ctc_rpt.dat _${DestType} ${CURR_TIME_STAMP},TGDM01.T3113_DA_DLVR_SP a,'file:'$AI_SERIAL_LOOKUP'/mssu2_massched.mssulrm_lkup_'$AI_PHASE'.txt',$PRIVATE_SCRIPT/1_ctc_rpt_dds_extn_stage_to_base.ksh ${AI_SERIAL}/${AB_JOB}_ ${DestType} ${CURR_TIME_STAMP},TGIDM01.T3121_RT_REQ_CHK b'file:'${AI_SERIAL_TEMP},,TGIM01.T3121_RPT_RQ_CHK