I want to build a script

I have file which has "A" character in more than 1000 lines and I want replace this "A" with "f". There is also "A" which I don't want to replace at the last line.

Currently, I use this script to replace them one by one

:g/A/s//f/g

Regards

Try:
sed -e '$q' -e 's/A/f/g' < inputfile > outfile

hi buddy

use the following

:<line1>,<line2> s/A/f/g

here line1 tells from where you want the change to take place and line2 tells u till where u want this change.