Ciao scusa ho  avuto un un'imprevisto.
Per utilizzare questo codice occorre file.html in ordine decrescente e tutti i vari file collegati.
file.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title></title>
  <style>
  span {font-weight: bold; font-size:12pt; color: red;}
  </style>
</head>
<body>
<span>Nome3</span><br>08.05.20  - 11:11:46<br><em>terza prova</em><hr>
<span>Nome2</span><br>07.05.20 - 12:56:05<br><em>seconda prova</em><hr>
<span>Nome</span><br>07.05.20 - 04:53:26<br><em>prima prova</em><hr>
</body>
</html>
file che riceve i dati dal form con method POST
<?php
if(isset($_POST['scrivi'],$_POST['name'],$_POST['message']))
	{
	if(!is_writable($my_database)){
		exit("il file non ha i permessi di scrittura!");
		}
	// riceviamo i dati e li filtriamo
	$bad_char = array("|", "\r\n", "\r", "\n");
	$name = htmlentities(str_replace($bad_char, "", $_POST['name']));
	$message = htmlentities(str_replace($bad_char, "", $_POST['message']));
	$date = new DateTime();
    $date = $date->format("d.m.y - h:i:s");
    
	// apriamo il file
	$open = fopen($my_database, "rb");
        // leggiamo il file
        $content = str_replace(array("\r","\n\n"),"\n",fread($open,filesize($my_database)));
        $content = substr($content,strpos($content,'<body>') + 6);
        $contents = explode("\n",$content);
        fclose($open);
	// scriviamo i dati
       $open = fopen($my_database,"wb");
        fwrite($open, '<!DOCTYPE html>'."\n".'<html>'."\n". ' <head>'."\n".'  <meta charset="utf-8">'."\n".'  <title>test</title>'."\n".'   <style>'."\n".'  span {font-weight: bold; font-size:12pt; color: red;}'."\n".'  </style>'."\n".' </head>'."\n".'<body>'."\n");
        $string = "<span>".$name."</span>"."<br>".$date."<br>"."<em>".$message."</em>"."<hr>";
       $count = count($contents);
       $stop = $count > 1 ? $count - 3 : $count -1;
	do {
fwrite($open, $string);
fwrite($open, "\n");
        } while (($var = key($contents)) <= 50 && ($string = next($contents)) && $stop >= $var);
        fwrite($open, '</body>'."\n".'</html>');
	
	// chiudiamo il file
        clearstatcache();
	fclose($open);
	// ritorniamo nella pagina di visualizzazione
	header("location: form_insert.html");
	exit;
	}