Hai friends why we need to read a file before re-write a record?
Rewrite is nothing but Update so if you want to modify/changes in the record you should read the record first, which you want to then you can rewrite it. I hope it will clarify your doubts.