What should I do if my daughter was banging her head on purpose?

Nothing. Infants and toddlers bang their head against things testing out new sensations. Obviously it can hurt so after doing this long enough they will stop. Having said this some head banging can be part of some psychological issues in the child (older). Talk with your pediatrician if you are concerned.