How to output a text to both terminal and install.log
This is simple you can ua the following ways:

command | tee output.txt

The standard output stream will be copied to the file, it will still be visible in the terminal. If the file already exists, it gets overwritten.
command | tee -a output.txt

The standard output stream will be copied to the file, it will still be visible in the terminal. If the file already exists, the new data will get appended to the end of the file.

If you want any to know where I got this here is the reference:https://askubuntu.com/questions/420981/how-do-i-save-terminal-output-to-a-file/420983 @Byte Commamder.