Hi Amena,
A male cat with urinary problems could be the result of a medical issue and I would strongly suggest getting him to a veterinarian immediately. Urinary crystals potentially causing an obstruction would be high on the list of possibilities. Some of the spraying may be contributed by him not being neutered. Behavioral issues may also be at play depending on what else may be going on in or around the home. Regardless, an exam and consultation with your veterinarian is prudent.
I hope this gives you some direction.
Dr. Ryan Llera