You had
...
x1 = xi + dt*(a*xi*(1 - xi/20) - b*xi*yi - c*xi*zi);
y1 = yi + dt*(yi*(1-yi/25) - a*xi*yi - d*yi*zi);
before with both c and d undefined in the posted code (as well as were a, b and other things...so those had to have been set in workplace before.
Now you've introduced and reused variable c for some other purpose -- that undoubtedly is at least part of the problem.
I recommend strongly pull all your code together in one script m-file; and make sure it's working again completely independently -- putting a function keyword at beginning would make it such that anything not defined in the function would be flagged...
Then, once you've got that working (again), then you can introduce some new counter variable...