here is the command to save output to file

db2 -r out.txt

more help type:  ? options inside the db2 console