Relay Controlled Door with Limit switches.

Thanks for the help but I did not get the answer to the first question is still.

You have fundamental issues in the structure of your code. You really need to address them first.

What you are doing is a bit like going to the doctor complaining about a hangnail. The doctor discovers that your arm was nearly removed by a chainsaw accident and is barely hanging on. You tell the doctor to just mind his own business and deal with the hangnail. I don't think you'd get any help from him until you stopped bleeding all over the place and it was known whether you'd even keep the arm.

The same situation applies here. You must organize your code properly, and quit trying to circumvent how an Arduino is supposed to work. Then, if the original issue still persists, we can help you resolve it.