Keyboard, joystick and mouse buttons work well in _Process, where you can check using InputMap if one button is pressed or released. To control the mouse motion, you should use _Input(InputEvent e) in this way:
public override void _Input(InputEvent input) {
if (input is InputEventMouseMotion motion) {
GD.Print(motion.Position+" / "+motion.GlobalPosition);
}
}
If you already have your code in _Process and don't want to mix your logic between _Process and _Input, you can do this in your _Process
Alternatively, it's possible to ask the viewport for the mouse position:
GetViewport().GetMousePosition();