print stdout to result.txt