Jenny, you may not have done anything "wrong" at all. Sometimes infections (and other illnesses) happen.
I am not sure why, but UTIs can be very common in PWDs (persons with dementia). It could simply have to do with getting older making us more vulnerable to all sorts of medical issues, which you can't do anything about, or it could be something else. Not a medical expert! All you can do is what others here have said: try to keep the person hydrated (if they don't want to drink enough, try liquid-heavy foods as well), try to get them to go to the toilet regularly, use good hygiene, you know all that stuff.
Maybe he won't ever have another UTI and you won't need to worry about it.
Or maybe he will, and you will learn to spot the signs earlier. They can include dizziness, problems with walking, sudden change in behaviour and personality, burning/pain on urination, confusion, delirium, fatigue, or there can be no discernible symptoms. If you feel something is off, or just not quite right with your dad, don't hesitate to get it checked out.
Sometimes a UTI can be difficult to clear, or can recur quickly, and need more than one course of antibiotics. If that happens, I'd ask for a urine sample to be cultured to make sure the best possible choice of antibiotic is being used.
Some PWDs are so prone to UTIs or other infections, that they are on a low maintenance dose of antibiotics all the time.
Something here may be of help:
https://www.alzheimers.org.uk/info/20029/daily_living/13/toilet_problems_and_continence
Or here:
https://www.unforgettable.org/blog/why-do-urinary-tract-infections-utis-affect-dementia/
A lot of us have PWDs who don't want to drink enough fluids, for whatever reason. There might be something helpful here:
https://www.alzheimers.org.uk/info/20029/daily_living/10/eating_and_drinking
Sometimes you have to find the right beverage, sometimes the right container, sometimes you just have to sit and eat/drink with them (my mother went through a phase where she would not eat anything at all, unless seated at a table across from someone who was eating), sometimes nothing works.
You can also include more fluid rich foods in the meals: broth, soup, jelly, fruits and veggies, applesauce, et cetera.
Hope your dad recovers well and best wishes to you.