OK, here's why:
your original code would only ever execute one time for the first item in the cart.
by adding a cart loop:
while (!$eCart1->EOF()) {
<do stuff>
$eCart1->MoveNext();
}
the code will execute once for each line item in the cart. the line:
$eCart1->MoveNext();
moves the reference to the next line item.