In addition to what RudiC and Scrutinizer have already said, why would you write a 28 line Korn shell function using a pipeline of echo and awk to get at awk 's printf function when ksh 's built-in printf utility can do the same thing in 5 lines?
Note that the leading space on the 1st line of your script makes that line just a comment and removes its ability to specify that your script is to be run by /bin/ksh .
#!/bin/ksh
set -x
fixed_output_format()
{ echo " We are inside Module "
printf '|%-6s|%-3s|%-2s|%-3s|%-4s|%-5s|%-6s|\n' \
"$1" "$2" "$3" "$4" "$5" "$6" "$7" >> OUTPUT_FILE
}
################
echo " we are the start of script"
fixed_output_format a b c d e f g
And, note that calling this function fixed_output_format is a misnomer if the arguments you supply to this function contain strings that are longer than the specified field widths. If you really want fixed width output for each field (truncating long input strings), you would want to change: