Before you go anywhere you need to define some basic parameters.
For example, what do you want/intend to 'clean up'?
It sounds like a dumb question, but it isn't.
No script can decide for you what your 'cleaning' should consist of - sure, it can find old files, or big files, or files with specific names, or in specific directories, or owned by specific users, or any number of other parameters, but you're the one that has to define the scope and the limit... HOW old? How big? What names?, etc.
Once you know what your rules are you can look at different implementation options, but as it stands there really isn't much you can do since your target is ill-defined.
Then you need to make sure your data is backed up properly. At some point, one day, ANY 'clean-up' task, whether manual or automated) is going to throw away a file that someone absolutely desperately needs. It's going to happen, and you will need a backup of your data that you can fall back to.
As a final thought, computers perform this task pretty awfully - there's often too much subjectivity in deciding what is worth keeping. Don't be surprised if your cleaning 'process' comes down to you dedicating an hour or two every week/month to take a look at what's there, rather than a headless automated script.
OK... if that's what you want, it's trivial.
You can do it via AppleScript and the Finder:
tell application "Finder"
set oldFiles to every file of entire contents of disk "Volume Name" whose creation date is less than ((current date) - 30 * days)
but the Finder is notoriously slow in dealing with large numbers of files and folders. If the disk is large (or, more correctly, if there is a large number of items on the disk) you may be better off with a shell command instead:
do shell script "find /Volumes/VolumeName -Btime +30 -delete"
So if I do this shell script, it will continue todo this until I excute another code to stop or is this code have to be ran everything I need it to work?
As written, the shell command will find files, delete them and then go away.
In the same way the AppleScript version will tell the Finder to find files and delete them, and then go away.
So both approaches will need some kind of schedule behind them if you want them to run automatically. launchd would be the presumed approach since it can launch any task on just about any schedule you like.