The following code can be used to add item lines in the sales order when clicking submit button in the popup triggered from the sales order.
Suitelet POST action:
    let html = '<script>'
                    for (let key in freeItems) {
                        let itemObj = freeItems[key];
                        html += `window.opener.nlapiSetCurrentLineItemValue('item', 'item', ${itemObj.custpage_selected_item}, true, true); `
                        html += `window.opener.nlapiSetCurrentLineItemValue('item', 'price', ${- 1}, true, true); `
                        html += `window.opener.nlapiSetCurrentLineItemValue('item', 'quantity', ${itemObj.custpage_selected_quantity}, true, true); `
                        html += `window.opener.nlapiSetCurrentLineItemValue('item', 'custcol_jj_item_brand', ${itemObj.custpage_selected_prod_brand}, true, true); `
                        if (itemObj.custpage_selected_free_item == 'T') {
                            html += `window.opener.nlapiSetCurrentLineItemValue('item', 'rate', ${0}, true, true); `
                             html += `window.opener.nlapiSetCurrentLineItemValue('item', 'amount', ${0}, true, true); `
                              html += `window.opener.nlapiSetCurrentLineItemValue('item', 'custcol_jj_free', true, true, true); `
                             
                        } else {
                            html += `window.opener.nlapiSetCurrentLineItemValue('item', 'rate', ${itemObj.custpage_selected_price_aux}, true, true); `
                             html += `window.opener.nlapiSetCurrentLineItemValue('item', 'amount', ${itemObj.custpage_selected_total}, true, true); `
                        }
                       
                        if (!isEmpty(itemObj.custpage_selected_discount)) {
                            html += `window.opener.nlapiSetCurrentLineItemValue('item', 'custcol_acs_discount_applied', ${itemObj.custpage_selected_discount}, true, true); `
                        }
                        if (!isEmpty(itemObj.custpage_selected_free_item == 'T')) {
                            html += `window.opener.nlapiSetCurrentLineItemValue('item', 'custcol6', ${Number(itemObj.custpage_selected_price_aux) * Number(itemObj.custpage_selected_quantity)}, true, true); `
                        }
                        html += `window.opener.nlapiCommitLineItem('item'); `
                    }
                    html += `window.onbeforeunload = null; `
                    html += `window.close();</script > `
                    scriptContext.response.write(html);