Custom Variable Problem


We are trying to count the unique number of visits using custom variables.
Each time a user logs in, the custom variable is overwriting the previous user information. So, the count is showing up as 1 always against the latest user and the older user information is gone.
Following is the code snippet. Can any one help me in getting this correct?