Dear Fabio,
This may be of help with your problem, and as the Proff says AppendTo is very slow above a few thousand deep, I use the following Commands, Sow and Reap, the little snippet of code shows an example of its use.
Timing[vv = Reap[Do[Sow[{n, 2 n, 3 n}], {n, 1, 2000000}]];
vv = Flatten[vv[[2]], 1]; Length[vv]]
{2.418016, 2000000}
Extracting the second part of the list removes the null statement part and flattening it reduces the 2 deep list to 1. Maybe this could be implemented in your code.
Paul.