how to Do a golf swing?

Hey guys im pretty new at this stuff, and im trying to program the golf club to swing and hit the ball. I need to control direction, and angle. I can make the golf ball move and go where i want, and maybe im thinking about this wrong, but i want to pick the angle which im shooting, have the club hit the ball and fly x amount of distance. Thanks!