i cant see anything you did wrong, im of the opinion, that there gonna try and fuck with your mind to get every penny they can, because thats how they get paid, so its perfectly ok to return the favour in kind which it sounds like you did

personally though, i usually buy from private sellers and take my friend whos a mechanic, if they wont let a mechanic take a look at it, then i wont buy it.
avoid the dealers markup altogether.