I think it's just that when you echo the string it's used as html, and newline characters don't actually make a newline in html, they just get translated to a space. So it will probably be OK when it's displayed in a post (since a newline in bbcode becomes a <br />). But to see it in your test program maybe you could do something like this:
Code:
echo "<br /><b>Post ID:</b>" . $postid . "<br /><pre>". $recipe."</pre>";
Edit:...well, I guess if you put the entire recipe in <pre> tags you won't see any of the other formatting you added.