If you sell or buy at "Market", you are saying you want to sell or buy at the current highest buyer or seller offer price.
Market sells have nothing to do with your purchase price, completely separate.
The volume to be bought or sold needs to be there also otherwise partial transactions can happen.
I personally dislike using at Market to buy. If the price is jumpy, a market sell might jag you a better price, but again you might only sell 1 share before the price moves away from the market from when your order was placed.
When an order is entered at Market, usually the price for the trade is fixed at the current bid (buy price) or the current offer (sell price).
Some brokers have a Market buy sell which will chase the price up or down to complete the trade fully, if it doesn't trade completely at one price point.
Clear as mud?!
If you are confused about it, watch a you tube or two.
At market is probably not the best thing for anyone new to buying or selling IMO, and there's a risk increase by using it.
F.Rock