How to move cursor diagonally between external display and MacBook's built-in display?

How can I move the cursor so that it transitions between the external display and the main display as shown in the image? In a manner of speaking, it was possible to move the mouse cursor between the displays as shown in image 2.
However, you may be surprised that the mouse cursor can move just by touching the bottom part of the external display. I would like the mouse cursor to move to the main display only when it is moved in that direction. What is the best way to achieve this?

I’m not following. Maybe if you explained what you’re trying to do? Because you can set the mouse to move anywhere you want with x,y coordinates.

I would like the mouse cursor to move to the area between the main display and the external display only when it is intentionally moved in that direction.
If the cursor is moved directly below or in a direction where there is no display, I would like the action not to trigger.
I anticipate that by setting a variable for the past mouse position and calculating the current mouse position relative to it, we could determine the direction the mouse is moving and use that as a condition to control when the action fires.

Would something like this be possible?