and, the Red from the "Sensor" goes to the Black of the Lamp (fixture)The white from the Romex goes to the white of the fixture and the white of the photo sensor.
The ground from the Romex goes to the ground of the fixture and should also be attached to the box.
with the Black of the "Line" going to the Black of the "Sensor".
Apart from the "Grounds", the wiring should be as shown in the following diagram.
The way in which you have this wired the "Switched Line" (Red) will be connected to "Ground" when the "sensor" operates, which could (should) destroy the sensor and/or trip the breaker.
If you have "tested" this I fined it hard to understand why that has not already occurred !