how to add serial number on sales invoices and on purchase
Read the Guide: https://www.manager.io/guides/18764. This assumes you are speaking of a serial number for the transaction itself.
If you are referring to serial numbers for individual items sold or purchased, use line-item custom fields. See https://www.manager.io/guides/10411.
If you are referring to numbering the lines on the form, use a custom theme. See https://www.manager.io/guides/10303.