Interesting. To me, that feels like a file permissions issue.
Can you change the output.txt path to your desktop or somewhere else and see if the output file is correctly written?
If so, you'll want to check the read and write permissions for your mame folder.
If not, the user executing mame may not have high enough permissions in general. Try running it as administrator to check.
If not those, then I'm not sure what's going on.