The ">>>" tells us that you are in the python interpreter, instead of within the outer shell/terminal. Essentially, you're trying to write a python script that installs pyautogui instead of installing pyautogui to your python.
Instead use whatever your terminal to directly install it with "pip install pyautogui" or something like "python -m pip install pyautogui". You can also activate a specific environment first if you're trying to install it into a specific environment instead of globally (which is typically suggested).