I've come across this well after it will have been helpful to you, but maybe someone else like me can benefit!
It turned out that, when the Inventory Status feature is enabled, NetSuite creates a line in the Inventory Detail 'inventoryassignment' sublist automatically (as can be seen in the UI). That line is also available when scripting, so you don't need to use insertLine(), only setSublistValue(..., line: 0) and you should be good.
Source was here (quoted from SuiteAnswer 81448): https://community.oracle.com/netsuite/english/discussion/4498970/suitescript-you-still-need-to-reconfigure-the-inventory-detail-record-after-changing-the-quantity