how to add Rigidbody and Collider to line renderer

I want to make an application that let you draw anything using line renderer or any another method like in brain dots game where we make something to join both balls i search how to do this in unity but i got only how to draw circles or lines using unity but i also want to attach it Collider and Rigidbody in Unity 2D please help me.

I’m not sure what platform/device you’re targeting, but what you may want to look at is following the user’s current cursor position with a GameObject with a line renderer component.

You could choose to use something like the following code to get the user’s current position:

    RaycastHit2D hitInfo = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
    ray = Camera.main.ScreenPointToRay(Input.mousePosition);

    if (hitInfo.collider != null) {
        int x = Mathf.FloorToInt(hitInfo.point.x);
        int y = Mathf.FloorToInt(hitInfo.point.y);
        currentPos = new Vector3(x, y, y);
    }

    currentPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

I suggest providing more information to your question: nobody wants to tell you exactly how you should program your idea.