The coding style is wrong. Don't use this kind of "FOR" loop and you cannot synthesize.
Better change the logic and then try. With the combination of XOR gate and a counter you can achieve this..
For loop is synthesizable only.
for loop, if statements should be within always block.
put "count" also inside always block.
without using assign.
Do this changes along with what "FboDigit" suggested.