How to delete pre existing code from arduino?

I can't really answer without knowing what you are trying to do. If your old code will cause a problem for your new circuit then by all means upload your new code before making your circuit.

Edit or do as @squirrel_it suggested.