Hi Amit,
Here is a way to do it via UIAPI:
Setting a Freight by the UI API ?
If you need to do it via DIAPI, have a look here:
How to update amount in freight column(INV3) of A|RInvoice through SDK
DI Copy AP(AP Invoice) from PO(Purchase Order)
Populating Freight Charges on Sales Order
Hope it helps.
Thanks & Regards
Ankit Chauhan