How to create script and run it only manually from backend

Hi,

I want create script, which will send all orders, one by one to API (invoice system).
But i need to run only once. For next orders i have script which send it automatically, i just need send old orders too…
My question is: how to create script, which I can execute from backend and not stress server - it is around 2000 orders…