Yes, create a new file copy all the data from the old file to the new file, except that line you want to replace, remove the oldfile rename the new file name to the oldfile name or simply just use write_file( const file[], const data[], line=the line position you want to replace )
1st method is the solution for Cant write file access problem for some hosts.