You need to check the enclosures temperatures. It may be too hot for the snake, hence why it wants to get out all the time.
There might be an item or decoration in the cage the snake does not like. Try to change things around, add or remove items until the snakes behaviour changes.
Check that there is no uneaten prey items hiding in the tank somewhere.