Period of stay after H1B petition

I am ending my OPT in Aug 2020. I have been selected in the lottery this year. I have a job and they want me to continue. Up till what time can I continue if my H1B petition is not answered? Do I have to go back to India and wait there till I get an answer?5