What is the purpose of 9th pin in ULN2003
As with just about every other component in existence, you could have found the answer by reading the datasheet



It's used when you're switching an inductive load (a motor, for example) and you need flyback (a.k.a. freewheel) diodes to protect the transistors from voltage spikes when the motor stops. It's a common cathode for all of the freewheel diodes. If you're only switching something like LEDs or other non-inductive loads, you can leave it unconnected. Relays are inductive, though, so I would connect it in your case.