unix script optimization

I have a file which contains 9,200,000. It contains 125 clolumns. I have to rearrange some columns and exclude some of them. I scripted the following script to do the same. It is working fine but it is taking more than 4hrs to do it. can it be optmized.
Here is the script

LOC="/sourcefile/"
LOC_FINAL="finalfile/"
Path="base path"
line_num=`wc -l $LOC"abcd.txt"
 
#making directory for temp files
mkdir tempfiles2
chmod 777 tempfiles2

#getting the coloumn names
head -1 $infile > headers3

#removing the newline character and return carriage from headers
#cat $LOC"temp5" | tr -d '\n \r' > $LOC"temp6"
cat headers3 | tr -d '\n \r' > headers1
cat headers1

#now we have the headers so we will create the tem files for all the headers
file_nam1=`cat headers1`
file_nam=`echo "$file_nam1" | tr "\"" " "`
field=1
for i in $file_nam
do
        echo "$i created"
        awk -F"\"" '{print $'$field'}' $LOC"abcd.txt" > $Path"tempfiles2/$i"
        field=`expr $field + 1`
        chmod 777 $Path"tempfiles2/$i"
done
 
#now checking for the missing coloumn names
find_file=`cat abcd_ref`
 
line_no=`echo $line_num |sed 's/ //g'`
echo "line no=$line_no"

for i in $find_file
do
missing_col=`grep $i headers1`
if test "$missing_col" = ""
then
        echo "$i not found"
        #putting tabs in the missing file
        count=0
        while test $count -le $line_no
        do
                echo "  ">$LOC"tempfiles2/$i"
                count=`expr count + 1`
                line_number=`wc -l $LOC"tempfiles2/$i"`
echo "line number of the missing file:$line_number"
        done
fi
done

#now temp files are created, we have to append them in an order

cd $Path"tempfiles2"
paste file1 file2 ........ file 100 > final
 
cp final $LOC_FINAL"abcd.txt"
 
#removing temp files
cd ..
rm -r tempfiles2
rm headers1
exit 0

please help:(

it will be easy for us if you can provide some i/p data and the desired o/p

what does $infile contain because i don't see any variable infile in your script
If you are selecting head -1 then i don't think you have to get rid of newline character any way its a single line so i didn't get what
cat headers3 | tr -d '\n \r' do??
from where this abcd_ref file came ???
and many more doubts in your script its hard to follow

basically this part of script is posing all the problem...
The abcd.txt has some 92,00,000 records...
$file_nam contains the list of headers for which temp files will be created

so any ideas how to make this loop faster???

for i in $file_nam
do
echo "$i created"
awk -F"\"" '{print $'$field'}' $LOC"abcd.txt" > $Path"tempfiles2/$i"
field=`expr $field + 1`
chmod 777 $Path"tempfiles2/$i"
done