ok that means that i can stay here and apply for LMIA than apply for work permit outside Canada by sending my application.
Only if you have valid status in Canada. If you are out of status in Canada, you would have to leave Canada before you can apply for a work permit.
You should also be aware that it may be quite difficult to get a work permit approved since this requires you to demonstrate that you have strong ties to your home country and have no plans to remain in Canada long term. This will be difficult for you to do give your history in Canada.
Your best option is to qualify and apply to immigrate through an economic immigration program like Express Entry. As in the case of the work permit, you must have valid status in Canada if you want to apply within Canada. If you are out of status in Canada, you would have to leave Canada and apply from your home country.