Yep, it's the sensor for the low fuel light. Never were particularly reliable. The MG Cycle part appears to be of a different design, so perhaps it will work better.
Presumably when you removed the tank you disconnected the electric petcock harness. The missing fuel sensor connection should share a bundle with it, so follow it back. If I remember correctly, the fuel light and petcock connectors are identical, so take care not to get them mixed up when putting everything back together.
As he says take care not to mix the two or you can burn out the sensor if you get it mixed with the Electric Petcock
Is it possible to re-attach the wires, a new sensor is quite expensive.
The sensor is a thermistor, it will measure between 1 & 2 Ohms check for that with a multimeter, if so it's probably ok
When it becomes uncovered it starts to warm up which brings the resistance down resulting in faster heating and less resistance untie eventually it turns the fuel light ON
I always had good results with these if it wasn't already burnt out.
BTW plugging it into the petcock connector won't do any damage if there is lots of fuel in the tank but if the tank is empty it will become white hot and self destruct in seconds, this won't set fire to the fuel because its contained within a tiny metal capsule that cools the flame.