Reading contents of files from a directory

I have a directory with the files,

1st: I want to Diplay each filename, underline it
2nd: Display the contents under the filename and
3rd: Redirect the above content to other file
4th: Remove the files from the directory

 
#!/bin/ksh
for i in $( cat $a/b/c.txt )
do
echo " Contents of the files "  > $t1/t2/content.txt
echo " ===================================================== " >> $t1/t2/content.txt
echo $i >> $t1/t2/content.txt; cat $i >> $t1/t2/content.txt
rm $i
done
 
 
 
Desired out put in redirected file:
 
Filename1:
==========
Content of Filname1
Filename2:
=========
Content of Filename2 
 

Thanks

If you want to display the output on stdout and save it in file as well, you can use the tee command.
Try:

for file in /path/to/your/directory/*.txt
do
  echo "$file" |  tee -a out_file.txt
  echo "======================================"
  cat $file | tee -a out_file.txt
  echo | tee -a out_file.txt
  mv $file ${file}.old  # change this to rm to remove the file.
done

When you test this script make sure that the correct files are removed.