I would prefer having hotkey for saving this info into file.
Or, having same/other hotkey for printing this info into console.
Just because constant-writing to disk isn't good idea,
because I don't know any app which able to refresh file runtime.
and if you need to capture some moment, it will run away because of fps.
in case if you need just single frame, you'll have to pause and seek for frame.
similarly you can do same with those hotkeys.
but with hotkeys you'll avoid spam in disk or console.
if you anyways working in frame by frame mode, you can just add some separators into your console, to make things clear, and avoid using files again.
For example:
Language: lua
print(string.format("===Frame %d", emu.framecount())) -- separation
print(string.format("HP: %d X: %d Y: %d", HP, X, Y))
print(string.format("SpeedX: %d SpeedY: %d", SpeedX, SpeedY))
....