tee is Linux shell command using which you can redirect a program's output to the screen as the same time dumping it on a file.
Usage:
$ < program> | tee < output_file>
If it is your own program, make sure that it flushes the output time to time if you want to readily see the output on the screen.