In the for loop, just get the value of the field and check if it is empty or not and continue if it is not empty.
for (j=1; j<=lineCnt; j++) {
var qtyPickPackShip = recSO.getLineItemValue(‘item’, ‘quantitypickpackship’, j);
// Continue to the next iteration if quantitypickpackship is not empty
if (qtyPickPackShip) {
continue;
}