You are in a deep hole right now with multiple issues that feed off each other, affect your mental state, and make it hard to solve any one of the issues.

Obviously I am only going off of what you wrote here, which is brief and lacking all the context. I have absorbed it and am responding the way I interpreted it, and I could be way off.

You have a lot of regret, and regret feeds into "rumination" - the endless loop of replaying past events and perceived failures in your head. You should accept that today is a new day, you still have half your life left, and endlessly worrying and fixating on the past is not going to help you get out of this hole. Probably at this point you have thought about the past so much that there isn't much that thinking about it more will do.

Next, you should forgive yourself. You aren't a failure. You aren't a loser. Mistakes in the past are just that - mistakes. People can change and the first step is recognizing you want to change. You have so much time left and so much to live for.

You have something that so many people on earth want badly - their health and decades of life left to live. You can't imagine how many sick, elderly, disabled people would trade places you in a heartbeat. That isn't to say those people are without value (absolutely not!) I am just trying to put in your mind how blessed you are that you have your health and a long time to fix your issues.

You are not in any current mental state to date someone. I would focus on healing yourself and making yourself desirable to someone else before attempting the wife and kids, otherwise it will be a lot of regret. Dating is putting your best self out there as an attractive mate and being very depressed, anxious, and full of self-loathing will lead to more rejection which will just fuel more of the same feelings. You need to work on yourself before you can be ready to find a life partner. And plenty of men have kids in their late 40s or 50s - I know a guy who just had a kid at 65, for better or worse. As a male you can have children until the day you die, if that's what you want. The door is not closed on this.

Multiple other problems are here. Loneliness and lack of purpose are coming through strong. I think you should try and get a job (even a minimum-wage one) or volunteer in a place that involves other people. This could be at a restaurant, a pizza parlor, at a soup kitchen, working a customer-facing position, something low-risk where if you just can't hack it you can quit without much of an issue or reputational harm. You will start talking to people regularly and often you will interact with them not just about work or solving their customer issue, but start chatting about the weather, their families, and perhaps deeper things. I think this will help you come out of your self-imposed NEET shell and start becoming a normal person again. Often these jobs will lead you to getting to know your coworkers better and you might get invited to work-parties or similar things. There is no shame in working a food job or something like this, all work has value and provides purpose.

Finally, I have no idea if you are religious at all, but investigating religion or the spiritual side of existence may help you. Attending a Sunday worship be it Catholic, Eastern Orthodox, Protestant, or whatever has absolutely no requirement of you and it may deeply affect you in a way you aren't expecting. You can always leave or never come back, you may want to give it a try. Thoughts of the afterlife and "what all this means" is a common issue for people entering their mid-life and exploring this facet of existence may be helpful to you.

Good luck! You can do it. Don't give up! You made it this far, and you can make it farther. One day at a time.