lets say you have a file where you want to insert a string into an existing file at a specific location.
put a key into the file where you want the new text appear, i.e.:

###INSERTHERE###

then use this function to insert the new data at this keypoint

download options for string handling / insert at specific location

you can download the source as PHP file,

open the file as plain text in a new window or

get the code in a textarea to copy it.