How do i do so i can drag my mouse and make a line between my Ball and my mouse

I want to make a Golf game. I want to make a line that is connected with the mouse cursor and the golf ball. i’d also want to do so when i drag my cursor and the line becomes longer or smaller, then the ball would shoot depending on how long the line is.

Is there anyway i can do this ?