If you want to save command output to a file, use tee. tee is an Linux/Unix command that allows you to write or append command output to a file.
To save the output of a command using tee, type command | tee filename.txt as shown above.
Use tee -a to append text instead of overwriting text.