How can I change the movement of my character?

Get your CharacterMovementComponent, and set mode to flying.

Detect you Left Mouse if it click toggle some value, then in Tick keep update AddMovmentInput. Direction will be ControllRotation Forward Vector.

When released mouse turn off that value to stop fly forward. Remember to put value to Braking Deceleration Flying, so it will deceleration will you stop add input.