Hello,
Why do you want to code the autoclicker? Also, the Source code of autoclicker is available over the internet.
I am using the autoclicker software for my windows pc. It is safe and also very easy to use. Here is the reference from which I downloaded the autoclicker.
Let me know if it works for you.