Task in verilog code
The issue could be stemming from the fact that you don't have any delays in the verilog code under the for loop (including the code included in the tasks). There could be multiple driver issue.

You can try adding #1 in your for loop and see if that helps.

I notice that the question is pretty old. Might be useful for future exchangers.