you need to click on the warehouse where you want it to unload and select unload for whatever item it is you want dropped off. To sell it you have to manually do it when the ship is in another parties harbour, or you can offer it for sale from your warehouse and they will pick it up themselves (much better option)
when you open the warehouse window it will list what you have stored and how much, there should be a plus and a minus next to/under cant remember properly, the one is the option to sell, the other is the option to buy the good, just hover your cursor for an explanation of which is which, you can also set how much you want to buy/sell each time a ship comes buy so you have some left over for yourself.
Generally the trading routes are for transporting goods between your settlements, and not selling or buying, which you should manage from the warehouse window, while inter settlement good transport should be managed from the trading route windows.