I would say this is better located at the "How to" section of the board, but I do hope this helps:
as JavaScript is not able to write to a server, you need to set up a script (easiest to learn is PHP in my opinion). With PHP you can set up a script that will either write to a file or a database. From your game, you need to set up the Ajax plugin to call you PHP script with the parameters you need.
It would be too much to explain how to set up the script. But how to use the Ajax Plugin is well explained in the manual.
scirra.com/manual/107/ajax