i need to solve the model for these conditionals, but learning how to implement if condiitonal within model block but by using a loop from outside as in line 56. May you help me to figure it out please?

The error message is
Starting preprocessing of the model file ...
ERROR: There are 104 equations but 52 endogenous variables!
It’s like I'd have the double of equations but not, it is doubling the number of equations because there are two values 0 or 1 which enter into the conditional…what would be the error. How dynare it is not reading the @#for properly.