There are errors on lines 10 and 11. Also, in my particular case where I'm in the Customer Center, I needed to place this code in After Submit and load the record. Here is the corrected code:
for (var i=1; i<=numberOfLineItems; i++){
SOrecord.selectLineItem('item',i);
//First get the Lot Number and Quantity
var lotNumber = SOrecord.getCurrentLineItemValue('item', 'custcol_select_lot_number');
var quantity = SOrecord.getCurrentLineItemValue('item', 'quantity');
var available = SOrecord.getCurrentLineItemValue('item','available');
nlapiLogExecution('debug','lineNum, LotNumID, Quantity, available',i + ', ' + lotNumber + ', ' + quantity + ', ' + available);
var inventoryDetail = SOrecord.createCurrentLineItemSubrecord('item','inventorydetail');
inventoryDetail.selectNewLineItem('inventoryassignment');
inventoryDetail.setCurrentLineItemValue('inventoryassignment', 'issueinventorynumber', lotNumber);
inventoryDetail.setCurrentLineItemValue('inventoryassignment', 'quantity', quantity);
inventoryDetail.commitLineItem('inventoryassignment');
inventoryDetail.commit();
SOrecord.commitLineItem('item');
}
nlapiSubmitRecord(SOrecord);