You can buy items from NPC's and sell the items that you do not want any longer to some NPC's.
Click on the merchant NPC who is selling the item you want. The MerchantNPCs inventory will be on the left, and yours will on the right side of the screen.
.
Right click on the item you want to buy, this item will be in your inventory.
Or drag it to your inventory and click to put it.
Drag this item to merchant NPC's inventory and release to sell.