I don't think the guy was wrong in the least. You left. It does not matter that that was "just for one thing" = you left that meant the guy was next, not you. You had other options, ask some one to go get it, cash out and then go get it, asking the cashier what to do, get it next time - but by leaving you gave up your place in line. He was not rude to take it.