Arduino Mega send data to ESP8266-01 then ESP forward to RPI (MQTT)

aarg:
The appropriate sequence of AT commands, which are documented and downloadable from the Espressif site. You can see them in action in a multitude of example and working sketches.

No, if you look back at the first post, you'll see that OP's ESP is flashed for Arduino programming. AT commands aren't what he/she needs.

oibdrew:
That's what I've been trying to get help with. How to write a code that will pass the info? What command tell the Mega to send the data to the ESP and what tells the ESP to send the data that it received?

There aren't any magic "commands", you have to write programs (one for Mega, one for ESP) in the C / C++ language using the Arduino IDE. The tutorial that I linked has lot about receiving serial data, but not much about how to send it. Take a look here:
http://robotic-controls.com/learn/arduino/arduino-arduino-serial-communication
It's very basic code, but should get you started. See what you can put together and then post it back here for help.