Hi Maria,
Try the below code.
Data: wa_file type char255,
lv_text type char255.
clear: wa_file, lv_text.
**** Pre Logic
while <condition>.
lv_text = <logically correct value>.
concatenate wa_file lv_text into wa_file.
endwhile.
Transfer wa_file to <Filename>.
***** Post Logic