Error while uploading to Mega

I am using these guidelines.

i have completed step 2.
but after that when ever i try to upload a sketch to mega
i get the same error.

If you connect a device to the Serial pins (0 and 1) you may have to disconnect the device when programming. That Arduino MEGA has three other serial ports (Serial1, Serial2, and Serial3) you can use to talk to the ESP8266. If you use one of them then the Serial pins will be available for uploading sketches.

Select Tools > Board > Arduino/Genuino Mega or Mega 2560.