How do I format my server and start from scratch?

I want to completely write a new website and want a fresh server to work with.

Hi there,

There's no way to do that, but if you start a new web app, with a new virtualenv, and source code in a new folder, that should give you a fresh setup.

Alternatively you could sign up for a new account!

How can I write If, Loop function?

It sounds like you need a beginning Python tutorial. Google for "python tutorial" and choose one that you like.