You are saving it as an Array, try keeping it as an object and then use the CSV node to convert it to comma separated values before using the file-out node
Given you are only wanting to write two values, then your original function was 99% correct. You just needed to change the [m] for m in the return statement. Then you can forget about the CSV node.
In the file node you can turn off the append line ending, as you are getting extra blank lines you don’t need.
There is no easy way to just add the headings once. Easiest I probably just to create the initial empty file with just the headings in then let the flow append lines after that.