I don't think you need to reinvent the wheel, this is already done by many SMEs before you thought this as a problem. Please check solution offered by Mr. Ola Hallengren(MVP). You just need to download them and define your parameters which is also explained at his website. This is fairly easy, straight forward and very much reliable.
For index maintenance you can check this link --> https://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html
And for details on other solutions check --> https://ola.hallengren.com/
You might face some compatibility issue since you are on SQL 2005 however it shouldn't be show-stopper, you should be able to find a work around fairly easily.
In case, you would like to stick to something native to SQL then you can define a maintenance plan yourself and define at what fragmentation level you would be doing reorg and what should be threshold for rebuild, updating stats can also be taken care from there. Just note that its not that much reliable and configurable as former suggested one.
Many DBAs worldwide use Ola Hallengren's script and there is no issue at all.
Since sizing seems an issue here, I would suggest to use below parameters:
MinNumberOfPages - You could set this value to exclude small objects. Set a size, in pages; indexes with fewer number of pages are skipped for index maintenance.
MaxNumberOfPages - Set a size, in pages; indexes with greater number of pages are skipped for index maintenance. set this value to exclude larger objects.
OnlyModifiedStatistics - Update statistics only if any rows have been modified since the most recent statistics update.
Indexes - One more parameter Indexes can be used to define wildcard index names say from a to g, in next run from h to m etc.
Since you haven't given details of resources at this server, I am not sure whether your server would be able handle them all