I have a tl-wr740n and i tried to compile a build using menuconfig. Now i cannot access the router and can't even boot the router into recovery mode to unbrick
https://openwrt.org/toh/tp-link/tl-wr740n#debricking should help you, if you're lucky your OEM bootloader does support push-button tftp recovery. If not, I'd reconsider if you really want to go further, considering that this device is affected by https://openwrt.org/supported_devices/432_warning (but recovering via serial console is likely to work, unless you overwrote bootloader or wireless calibration data).
I tried using telnet but it shows 'network is unreachable'
No one said anything about telnet, tftp has nothing in common with telnet.
The debricking guide has a telnet command. It flashes the system led rapidly as the guide says it should but then i still cannot access the router.
What happens if you try ssh instead of telnet?
Router doesn't respond.