If your pen is working on your tablet, but it is moving the pointer on the wrong display it is an easy problem to fix. Usually this is a problem with pen tablets (screenless tablets) but it can also occur with pen displays
Overall: You need to go to your tablet driver and change which display the tablet's active area is mapped to.
For Wacom:
For pen tablets: In the Wacom Tablet Properties app, it will be under the Mapping tab, the Calibration tab
For pen displays:
In the Wacom Center app > Advanced > Advanced Settings > change Assigned display to your tablet
For Huion:
In the HuionTablet app, it will be under the a tab called Working Area
For XP-Pen:
In the XP-Pen Pentablet app, it will be under the Screen tab