Other people aren't noticing like I didn't at first that that romex is not his supplu line it's the lines from the ballasts to the bulb sockets. Replace all that romex wire with flexible wire. The cheapest suitable flexible wire is almost always extension cords and you can just use the standard 50' orange colored 3 prong with ground extension cords and cut the wire from them it's cheaper than buying wire off the spool. You don't need any super heavy duty cord the orange 50' cord will do just great.
I'll bet you that romex is broken that's why wiggling it makes it work. That wire can't handle being bent repeatedly and is just not suitable for this. Still not a fire hazard but just not right and won't work long term like this unless you hard mount the bulb and ballast and tack the wire in place where it never moves and then you can never adjust the height of the lights.
No need to be confused, just do it.