I have written the following script. It is not giving any error.
But it is also not creating any output file
for i in cat list
do
a=awk '{if ($1 == "H") print $0;}' $i
b=awk '{if ($1 == "D") print $0;}' $i
c=$(wc -l < $i)
d=expr $c - 1`
e=sed -n '$c'p`
f=sed -n '$d'p`
printf "$a $b $e $f\n" >> output.txt
done