Every number eventually returns a 1 or 4 in the ones place. I think what you're trying to do is count how many iterations it takes before you get there. If so, here's the answer:
y = 0; Do[y = x; i = 0;
While[y != 1 && y != 4, i++;
y = Total[Power[#, 2] & /@ ToExpression@Characters[ToString@y]]];
Print[{x,i, y}], {x, 99}]