I think Amurthy is tring to write anywhere he wants in a file that already exists.
This can be a little complicated and a few functions need to be writen to complete the task.
Heres how I would do it.
Read the file and write it to a temporary file until you reach the spot in the file that you want to add to. Then write to the temp file what you want to add/change. Then continue to read the original file and write it to the temp file. Once the whole file is writen to temp file, delete the original file and rename the temp file to the name the original file was named.
Or you could avoid the whole temp file and write the original to a variable(array maybe), write the change to the variable, then overwrite the whole file with the value of the variable. But this may create performace problems with memory when you have a huge file.
The first way probably would be better.
If your not part of the solution, there's good money to be made in prolonging the problem.