When you were diagnosed with the UTI, how was that done? With the subsequent treatments, how were you diagnosed with still having it? Did the do a urine test every single time? Did they find bacteria every time?
I wonder if you're having a prostate issue or low testosterone, or maybe even a thyroid issue, or any combination of those.
Doxy isn't a great antibiotic for a UTI, unless they did a sensitivity test and found that your bacteria was sensitive to that. Macrobid is a better one.
I think I'd start with an ultrasound of your prostate and testicles, a full urine culture (if that hasn't been done), and a hormone level test.
At 17, erectile issues should be taken really seriously because they can indicate some serious issues, including heart problems. Don't hesitate to tell your doctor about that. Push to get that figured out.
Let us know what happens.