Specifically, your FOR loop and the history clearing run in parallel, so by the time it clears, one point might have already been written, then wiped. Similarly, inside the loop you read the history in parallel to writing to the chart history. You cannot predict what happens first, but the outcome critically depends on order.
Execution order is most easily enforced via dataflow. try the following (and if you configure the Vi to clear indicators when called, the "history data 3" indicator won't show stale data from previous runs until the history is written.)