agrp87132:
I fail to understand why you think WiFi.h library should work with esp8266.It works with Arduino WiFi Shield
As far as I know ESP 01 is not Arduino WiFi shield, maybe I am wrong?
Edit: That is not your biggest problem though.
The OP is confused.
That schematic looks like he is trying to communicate via AT commands.
So the sketch is all wrong.
I suggest the OP read Martyn Currey's excellent tutorial: Arduino to ESP8266 By Serial Communication – Martyn Currey
.