You get wages in the nick depending upon what you do while in. Even if you do nothing you get a few quid a week 10 - 20 quid. Most spend it on shit but if you spent nothing and are released you may end up with a few 100 quid.
You can get an advance on universal credit ( 1 months worth) which again will total several hundred quid. If you are determined i doubt you would leave prison to sleep rough, there are enough agencies desperate to justify their existence trying to help.