how do i install stock recovery without lossing root??
You won't lose root if you have stock recovery.
Do you even have a stock recovery? If so, just place it inside the adb folder, open the command prompt change directory to adb folder, boot into bootloader mode and type
fastboot flash recovery name_of_recovery.img The same way you probably got custom recovery onto the device.
Won't lose root because of stock recovery. You'll lose root because of the OTA though, but even then it's easy enough to regain root. You can then either flash back the custom recovery OR boot the custom recovery. I'd suggesting booting the custom recovery that way you can make a nandroid backup of the updated system before you flash anything again.
fastboot boot custom_recovery_name.img If you're using TWRP then it probably won't make a backup of the stock recovery, CWM/Philz will work better for the nandroid. After you made a backup(If you choose to make a backup, again strongly suggested) then you can flash a custom recovery again.