Simply use '\o filename' as you are doing so. Write the queries as much as you want. It will automatically append the result in the specified file. Untill you use '\o' command again with new file name.