Para isso você pode usar o while loop ou o for loop:
import pyautogui
import time
i = 0
while i < 300:
pyautogui.moveTo(28,295,duration=0.5)
pyautogui.click(30,295,duration=0.5)
pyautogui.moveTo(650,220,duration=1)
pyautogui.click(650,220,duration=1)
pyautogui.moveTo(650,670,duration=0.3)
pyautogui.click(650,670,duration=1)
import pyautogui
import time
for _ in range(300):
pyautogui.moveTo(28,295,duration=0.5)
pyautogui.click(30,295,duration=0.5)
pyautogui.moveTo(650,220,duration=1)
pyautogui.click(650,220,duration=1)
pyautogui.moveTo(650,670,duration=0.3)
pyautogui.click(650,670,duration=1)