How can i store text in a file while automating desktop application?

Hello everyone,
I am automating some desktop application and i want to store some data generated from macro in a text file i.e. “.txt”
working on Windows 10 and Firefox browser. Please help.
Thanks in advance.

Couple a ways to do this but I think the easiest would be to call a small script with XRun passing the data to it which then saves as .txt

Thank you so much for your response.
can you please share the other ways(or any link if possible). I will be glad to have some example.
Thank you.

You can save to csv and then convert to txt or you can copy/paste into notepad or another text editor.

It would be easier doing it the first way with only 1 or 2 lines of code depending on what language you prefer.

Thanks a lot. I will try both.