How to execute “reboot recovery” in recovery mode?
TWRP recovery project make it like below maybe this can help


case rb_recovery:
            check_and_run_script("/sbin/rebootrecovery.sh", "reboot recovery");

Github ref