obvs you have the right idea. And as pinner said, EASE back into it. I use to run 4 laps around my track in just under 9, last time i checked it took me aobut..12 something and needed to pause lol. So what i told myself is just ease back into it. don't go and run 4 laps in one day, start with 1, and work from there. Do little by little, but keep upping the stakes or w/e you're trying to achieve. What i use to do at my gym was when i was in top shape (still fat/big but had a decent endurance) i was able to jog for 30mins straight, then i injured my knee, took time off , etc etc and could barely do 15mins lol
So what i did was one day i did 5mins, then next day 6mins, then next day 7mins...you get the idea and eventually i'll be back up there

slow n steady wins the race!