Yes in your first .begin export ----you can put your .end export but don't log off.
You can start your next begin export (in the same script) and end export and then logoff.
Bsically it is within your logon and logoff.
Please let me know if it helps you.
You can use these commands like .SET, .ACCEPT, to assign variable values and then you can use them in query.Also , we can define .LAYOUT to take the fields from input file to be used in the select query for data to be exported with little bit of programming. Of course , you can use INMODE,OUTMODE.