The method you have isn't a post, its a get.
Regardless of the method, you simply retrieve the values from the corresponding $_GET or $_POST superglobal, and then write to a file. You can use file_put_contents
with the FILE_APPEND as the third argument to write the line you want. The documentation does not specify, but the examples do indicate that you will need to manually add the \n (just use PHP_EOL for it so you don't have to worry about the OS).