If I have well understood your problem, you want to edit a file thanks to a "textarea" and it is just a problem of display ?
Assuming the fact your file is in a variable $text_from_file, you may try :
print('<textarea>'.htmlentities($texte_from_file).'</textarea>');