Chosen Solution

I plugged in a bootable pendrive and selected the pendrive(Named EFI) after holding option button. It showed apple logo for a minute. Then I hold power button for 5 seconds and restarted macbook. Now my macbook keeps restarting continously with a beep sound (the one which comes when macbook starts). How should i fix?

OK so your drive was setup as a dual boot config MacOS & Windows. There are a few different ways people setup Windows on a Mac partitioning the drive and creating independent boot volumes. Using BootCamp which is a VM volume within the MacOS to run Windows all in the same partition space. Most MacBooks just don’t have very large drives as such I would recommend using BootCamp as the better setup. If you got this system second hand then you should look at scrapping the config and redoing it and not bother setting up Windows if you have a 256 GB drive or smaller. If your system able to boot up under MacOS by its self? You imply you only tried the USB thumb drive. As for your thumb drive you should reformat it and configure it as an OS installer drive so you have a workable backup just in case How to create a bootable macOS Sierra installer drive or if you can How to create a bootable macOS Mojave installer drive I would not use High Sierra.