Not sure exactly on what you are trying to achieve but have a go with this
<?php
$fhandle=fopen("$username.html","w");
fwrite($fhandle,"<font face='comic sans ms' size='1'>$username's profile<p>$welcome<p><a href='".$_POST["email"]."'>email me</a><br><a href='aim:goim?screenname=".$_POST["aim"]."&message=hi'>im me</a>\r\n");
fclose($fhandle);
?>
I tested your version and got errors, this is error free as long as variables are defined