analog reference

How if condition will be satisfied every time?

Yes if you hold down the button for say one second it will be executed about 1000 times.
All it does is check if the button is down, it does not check that it has just gone down. In other words it checks for a level not an edge.

You need to read this:-
http://www.thebox.myzen.co.uk/Tutorial/Inputs.html