Profit means the amount YOU get (revenue) minus the cost you paid (expenses). Your expenses were $18. Your revenue was the total you earned from those 10 pies.
They were $6.5 each, which means that if you multiplied by 10, you would get the total.
p=6.5 x 10 - 18