Serial between ESP8266 and Arduino leonardo not working correctly

Please post the full sketches for both of the Arduinos

Is there a particular reason that you are using SoftwareSerial, particularly on the Leonardo ?