Well, depending on what you're using fopen(), there are a couple of possible solutions. If you simply want to eventually be able read the data sorted from newest to oldest, than you can use $array = rsort(file("filename.txt")).
If you actually need the data written from newest to oldest, then it's a little more complex. Assuming all the data in the file is already in the order it needs to be, then this might work:
<?
// Puts the current contents of the file into a string
$file_contents = file_get_contents("filename.txt");
// Opens the file for writing
$file = fopen("filename.txt","w");
$new_data = "New string to be added\n";
// Write new data then write the older file contents
fwrite($file,$new_data.$file_contents);
// Close the file
fclose($file);
?>