Use the script function PREP_PROCESS_VAR() to access the list of data in the variable. Then use the WRITE_PROCESS() function to write the txt file.
I have not played around with the PREP_PROCESS_VAR() function so I'm not sure of its exact syntax. You will have to look it up and test it yourself. But here is a small script I ran the other day to test the WRITE_PROCESS() function.
! Writes a report out to a custom flat file
:SET &HND# = PREP_PROCESS_REPORT(,&$RUNID#,'REP')
:SET &RET# = WRITE_PROCESS(&HND#,'\\t11946\Public\TestFile.txt',&$AGENT# ,'LOGIN.UC4',OVERWRITE)
:print "Results of write operation: &RET#"
:CLOSE_PROCESS &HND#