Yes, you can ask both to file for you. But you’ll have to pick one if both get selected. So think of how you will answer the other and consequences if any.
I have one more question as if both petition(from employer A and B) got selected in lottery and I want to go with employer A then I need to ask employer B to withdraw the petition and once the employer B’s petition got withdrawn then only I can go for H1B stamping with employer A So if the employer B refuse my request to withdraw petition then what will happen?
first of all both won’t get selected … how much every h1b filings you do only one filing is taken into consideration for lottery so it won’t increase your chances of getting selected… if you have luck the one that you have been chosen for lottery is picked you’ll go for stamping… Here is the reference filing multiple H1's does increase chances in lottery - H1B : General - Murthy Law Firm