cij
is only defined in the local scope of the loop but eval
always evaluates in the global scope. Adding a global
in front of the cij=...
should do the trick. But IMO you should refactor your code to not need an eval.
Also, you as a veteran should know how to quote code, please do it: PSA: how to quote code with backticks