I agree with Chella, it also worked for me, in that I did not get an expr error. I used the bash shell.
However, the sum was reported as zero. This is because a pipe-lined set of commands ( cat ... | while ... in your case) will be done in separate processes. This might be dependent on the shell; I have heard that the real Korn shell -- ksh -- does not exhibit this behavior. I tried it with pdksh and got a sum of zero. The variables in child processes are not available to the parent.
The usual solution to such a situation is to re-form the construction as: