My php form which saves the output in a text file glues the result to one string like:
Name1Email1The Message1Name2Email2The Message2Name3Email3The Message3Name4Emai
When you concatenate your input values like that you won't have any newlines; you can add them using the literal "\n" or "\r\n". To string them all together you can use the concatenation operator or use sprintf() like below:
$data = sprintf("%s\n%s\n%s\n", $_POST['name'], $_POST['email'], $_POST['messge']);
$file = "YOURDATAFILE.txt";
file_put_contents($file, $data, FILE_APPEND);
I also use file_put_contents() with the FILE_APPEND flag to append data to a file and save a few more lines of code.