atm security terminal using Fingerprint sensor. Help needed with the code

SoftwareSerial mySerial(10, 11);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

SoftwareSerial mySerial2(12, 13);

You have a Mega2560 which has 4 (in words: four) hardware serial interfaces and you use two SoftwareSerial instances? You know that SoftwareSerial is a crippled piece of software that you may only use if you have absolutely no other chance, don't you?

Next problem:

  finger.begin(57600);
  mySerial.begin(9600);

You initialize the baud rate twice for the same instance of SoftwareSerial. Guess which one will be used?

A baud rate of 57600 with SoftwareSerial will work only in the very seldom case of an extremely timing tolerant device connected to it.

BTW: Changing the Adafruit Fingerprint library to accept HardwareSerial objects instead of SoftwareSerial is simply a running a replace over the complete library. I would strongly recommend doing that.