First you have to provide the necessary information. First start with links to the used hardware! The standard ESP8266-01 doesn't have a pin 11 so I guess you're using another board. Maybe you use some other Arduino and connect it to a ESP8266-01 only for WiFi connectivity but that's too much guessing. That's the reason we always expect you to provide a complete wiring diagram in addition to the code.
Given you use an Arduino UNO connected to the ESP8266-01, this cannot work because you activate the hardware serial on pins 0 and 1 (Serial.begin(9600) and also activate a SoftwareSerial on the same pins. You cannot use the ESP8266's WiFi on the hardware serial pins and do debugging over the same pins.
OMG, what a mess. If you wire esp8266 to RX and TX pin, the sketch will upload to esp8266. The Uno is then only a USB-to-TTL-Serial adapter.
but the uploaded sketch replaces the AT firmware.
on esp8266 Arduino you use the ESP8266WiFi library, not the AT commands. see the examples of the ESP8266WiFi library in IDE Examples menu
you would use AT commands if you had AT firmware in esp8266 and Uno as 'host' which sends AT commands to WiFi module.
Thank you Juraj for the replying. What should i do then? Connect the RX and TX pin to pin 0 and 1 or other digital pins? And also, i have tried to download AT firmware in esp8266. But the serial monitor show all AT commands fail. What should i correct?
c) esp01 has esp8266 MCU and 4 pins are accessible. io 1 and io 3 are Serial RX and TX. io 2 and io 0 are boot config pins but can be used if the boot state is right. your current configuration uploads Arduino sketch to esp-01 using the USB chip of Uno.