Travelling outside US while H1B petition is pending

Currently, I have L1B and working with CompanyA. Company A applied H1B and it is pending.

Can i travel outside US and come back to US in L1B(before or after H1B approval)?

After i come back, i may switch to Company B, if my current H1B pettion is approved.

Is this advisable to travel outside US now?

If you leave US while H-1 w/ COS is pending, then your COS would be abandoned. Even after returning on L-1, you will remain on L-1. To move to H-1, you either have to file COS or enter US on stamped H-1 visa.

If you leave US after H-1 gets approved w/ COS, then you can return on L-1 visa prior to Oct 1, and still be on H-1 from Oct 1.