@Ph1709
When you purchase inventory, you post it to your inventory asset account, not COGS. When inventory sells, it is then posted to COGS, hence the name cost of goods "sold".
Inventory is not an expense until sold, if it was, it would be easy for a company to manipulate its income by purchasing a bunch of inventory at year-end, thereby reducing its income and reducing its tax liability. The IRS is not fond of that sort of thing which is why companies that keep inventory generally must use the accrual method of accounting.