if conditional by using loops outside the model

Hello may you help me looking at this code. It is supposed to get the loop @#for pp in 0:1 in line 56, which it is being grabbed for the if conditional in lines 111 to 114.
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.
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.