Replacing "\n" with "<br />"

i have a form that i want to to change all "
"'s in the form to “<br />”'s and then store them to a single line on a text file…but when i do this, when they write to the text file, it doesn’t store it on a single line, but on a different line for each "
"…can anyone help me? here is my code:

$title = htmlspecialchars($_POST['title']);
$title = str_replace("|", "|", $title);
$content = htmlspecialchars($_POST['content']);
$content = stripslashes($content);
$content = preg_replace("'
'", "<br />", $content);
$content = str_replace("|", "|", $content);
$day = date("d-n-y");
$time = date("g:ia");
	$news_item = array($day, $time, $title, $content);
$toWrite = implode("|", $news_item);
$filename = "data/news.txt";
if (is_writable($filename)) {
	if (!$handle = fopen($filename, 'a')) {
		echo "Cannot open file ($filename)";
		exit;
	}
	if (fwrite($handle, $toWrite) === FALSE) {
		echo "Cannot write to file ($filename)";
		exit;
	}
 
print "<center><b><font color=\"#009933\">Successfully added news post to database</font></b><br></center>";
	fclose($handle);
	} else {
		echo "The file $filename is not writable";
	}
print "<center><a href=\"news.php?mod=nadd\">add another news post</a></center>";

this stores this:
15-10-05|6:36pm|title|content
<br />newline
<br />newline

when i want it to store this:
15-10-05|6:36pm|title|content<br />newline<br />newline