Values of A,B and C variables are changing with time. I want to save the outputs in text file or in some other file format.
As you didn't specify your Arduino model I assume it's an UNO. As you didn't specify your operating system I assume it's Linux. So this is the solution to your problem:
Assuming some of the assumptions in Reply #2 may be incorrect another option is to use an alternative to the Serial Monitor - PuTTY is a good example - which does have the facility to save the received data to a text file.