You need to take your dog be seen by a veterinarian. This could be related to an infection in the bladder, penis, or prepuce. Bladder stones are also possible. The penis and prepuce also could have a mass present or a foreign body causing the problems.
Your dog needs his condition diagnosed and needs to be started on antibiotics and pain medication.
Your dog needs his condition diagnosed and needs to be started on antibiotics and pain medication.