I don't know about reading files, write files, etc... but, no... that is wrong...
PHP Code:
write_file( file_name, "pedrito", line );
With this, you are writing the file to pedrito.... You should READ the file first, to search "pedrito" and then use like Snow said, the write_file:
PHP Code:
write_file( file_name, "", pedrito );
To read the file i dont know but maybe you have to use this
read_file
__________________