Motion Sensor should turn Lights off when leaving Room

Hi there

In my bathroom I can only install a motion sensor for certain reasons. I would like to achieve that when entering the room the lamps turn on via the motion sensor. This is not a problem. The timer for switching off the lamps I can not use. Firstly, I stay in the bathroom for different lengths of time, and secondly, the lights should be switched off immediately when I leave the room. I want to achieve this with a second motion sensor, which is installed outside the room.

Now for the problem: I have set the motion sensor outside the room so that when I move, the group of lights in the bathroom are turned off. Only this does not work under any circumstances. The lights do not react and stay on.

What am I doing wrong or what other solution is there?

Thank you very much for your support!