Maybe you need to re-assign the result to the list:
(If this solves the problem, don't feel bad... you don't want to know how many hours I spent looking for similar mistakes)
Also, if the whole body of your module is a single If-statement, what do you need the module for?
You can just as well write
Code:
For[..., ..., LM = Append[LM, If[...]]]
instead of
Code:
For[..., ..., Module[m = If[...]; LM = Append[LM, m]]