Implement check for ">" or ">>" at the end of the command line followed by a filename. Write output of last command to file.
echo "Hello World" > myFile.txt
Append to file:
echo "Hello World" >> myFile.txt
You can go ahead and do this.