WHERE ID=" + context.LopendID
I suspect that you issue is related to either this logic, or a similar type of issue.
OK, there are a couple of issues with this job that I have spotted. I will list them below....
1) You are trying to write out to the same file context.LogDir+"temp.csv" using multiple tFileOutputDelimited components. This is not safe, but may have worked due to luck. Try opening two versions of the same .txt file and add text to both. Then save one. Then save the other. Open the file and you will not have all of the text you have written. That is a simplified example of what I expect is happening.
2) You are relying on a combination of your SQL query data order AND (maybe you do not realise this) the order of preference for the tMAP outputs (seen below)
This is not ideal at all and seems to tally with what you are experiencing when you say as the rows go up, the ordering starts to get thrown out.
What I suggest is that you rebuild the job to output to tHashOutput components instead of your file. Link the tHashOutputs so they are saving to the same location. Then use a tHashInput followed by a tSortRow component to order your data as required (this may need a bit of massaging to get the order you wish). Then write the file once you have controlled the ordering.