Your ball hit the flagstick on your putt. Ooops...
If it were Matchplay you lose the hole.
In Stroke Play you get a 2 stroke penalty (Rule 17-3 - Ball Striking Flagstick or Attendant). Incidentally the same penalty rule applies if you hit your own or your opponents equipment .
However, having taken your penalty the ball should then have been played from where it lies but you moved your ball to where you thought it would have finished if it hadn't hit the flagstick. Ooops.... So your friend is correct: You moved the ball and therefore played the ball from the wrong position (Rule 20-7 - Playing from Wrong Place) - 2 Stroke Penalty.
Hit the flag for three, so + 2 shot penalty, moved the ball so + 2 shot penalty, one putt to hole out = 8
PS. for those rainy days (or for those with too much time on their hands) the R&A have updated their website with an excellent interactive 'Rules' guide (with search capability). Check it out here:
http://www.randa.org/en/Rules%20and%20Amateur%20Status/Rules%20of%20Golf.aspx#/rules/