Can anyone help me, I want to install a motion sensor unit to my front porch lights.. which

Are recessed lights.

I have unscrewed the unit and found there are 3 white cables

I see two cables runs directly to the recessed main box while the other one I have no idea

I'm guessing that 3rd cable runs to all the recessed lights but I'm unsure.

I have about 5 lights fixtures and I want to steal power from the third light fixture.

Any ideas would be great!