The first thing that you need to do is see the vet to rule out a medical problem. Any time that our cats pee have litter box issues, this is our first place to look. This is most often caused by a urinary tract infection or crystals (or stones) in the urine.
If the cat feels pain every time that he enters the litter box, he will stop going in it at all, even for BM's.
If he's peeing in inappropriate places, you can try a product called Feliway. It contains cat hormones and will deter inappropriate soiling. Use it in all the places where he inappropriately soils to deter him from peeing there in the future.
You need to see the vet as soon as you can for a urine culture and to get a diagnosis and start treatment. Even if you recently did, you need to do it again. They may have checked for a UTI but missed the presence of crystals in the urine.
Let me know if you have more questions.
