Coffee should have no effect on your developing urinary tract infections. There is another condition, called interstitial cystitis, which is sometimes affected by coffee consumption, but this does not sound like the condition that you have been dealing with.
I can reassure you that urinary tract infections are very common in young, otherwise healthy women. This is simply because the urinary tract is very short from the bladder to the outside, and so it is very easy for bacteria to get in. Having 1 or 2 urinary tract infections per year would not be outside the range of normal, and it shouldn't cause you to be alarmed, especially if the infections responded promptly to antibiotic treatment.
If you continue to have more frequent infections, there are some things you can do to help prevent them. In particular good hygiene (wiping front to back always, wearing absorbent underwear) is important. Making sure to urinate immediately after having sex is also important. Taking a probiotic supplement may also decrease your frequency of infections. Drinking lots of water keeps your urine dilute and washes out your system.
If these approaches do not work, then you should talk with your primary care doctor
for more advice.