Suppose i apply for the job and gets an offer letter from the H1 visa sponsoring company and not get picked in the lottery for H1 visa so what need to be done in such cases?
That depends. If your employer have office in India, they may ask you to join India location office. If your employer have office in only US, they may allow you to work from home or may not be interested to proceed further.
This is my opinion only.