Hi @Tawfik and welcome to the forum from me.
Possibly to do with how you determine the shape to extrude. My method uses a ribbon rather than extrudeShape (which by the way uses createRibbon to build the extrusion)
Extrusions restricted to box https://playground.babylonjs.com/#X3UQ4P#10
Extrude from any mesh https://playground.babylonjs.com/#X3UQ4P#11