Are you willing to spend about $150 to go to a dog training class six weeks, once a week for an hour with your dog? These classes help you gain the skills you need and will make having a dog very easy.
If you aren't willing to do that, I would probably say you aren't ready for a dog. Cases like yours, where there's pressure to take a dog lead people to make decisions they otherwise wouldn't make. They are usually stepping stones to shelters once the owner realizes they didn't want a dog after all. That is, they don't really have the desire to learn to train their dog.
With a training class, you'll learn how to live with your dog, and avoid the problems that lead to taking a dog to the shelter.
Also, you definitely won't be able to train your dog to stay in the yard, even if you took the class and became a world renowned trainer, that's just not something they do.
He's just never been potty trained it sounds like, or not very well. But neutering will help with that, and other issues, but he just needs to be potty trained. That's another thing you'll have to learn to do.