Making a sword follow mouse movement

hey everyone,
I’m currently trying to make an arena slasher game and am trying to implement a mechanic that allows the player to control the movement of their sword by holding down the left mouse button and using the mouse movement to swing the sword around.

I’m new to coding with c# and unity in general but this is what I have so far. it’s not much but it is a start in the right direction. I have no idea if this is the right way to go about it by any means.

public class wepswing : MonoBehaviour
{
    void Start()
    {

    }

    void Update()
    {
        if (Input.GetMouseButtonDown(0))
            transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 1.5f));
   
    }
}

any help or sample code to help give me an idea of how to even go about this would be greatly appreciated thanks.

Check out this video using Final IK FINAL IK TUTORIAL - Aim IK Redirecting Animation - YouTube

It uses a swinging animation that is manipulated to have a weapon aim at an object. You could instead change it to look at a normalized vector of the cameras raycast for first person. Or, you could expand on the offset abilities it was talking about to use the acceleration from the mouse.