How to convert mouse input to mobile touch in unity

I am new to game development. I am try to make something like rise up. I tried to change the flowing code to make workable for mobile touchscreen unfortunately failed. can you help me how can I make flowing code for mobile?

private Vector2 mousePos;
private Rigidbody2D rb;

private Vector2 offsetClicked;
private Vector2 offsetReleased;

private void Start () {
    rb = GetComponent<Rigidbody2D> ();
    offsetReleased = transform.position;
}

private void FixedUpdate () {
    mousePos = Camera.main.ScreenToWorldPoint (Input.mousePosition);

    if (Input.GetMouseButton (0)) {
        Vector2 newPos = new Vector2 (
            Mathf.Clamp(mousePos.x + offsetClicked.x, GameManager.gm.cameraEdges.w + 0.32f, GameManager.gm.cameraEdges.y - 0.32f),
            mousePos.y + offsetClicked.y
        );

        rb.MovePosition (newPos);
        offsetReleased = newPos - (Vector2) Camera.main.transform.position;
    } //Clicked
    else {
        Vector2 newPos = new Vector2 (
            Mathf.Clamp (Camera.main.transform.position.x + offsetReleased.x, GameManager.gm.cameraEdges.w + 0.32f, GameManager.gm.cameraEdges.y - 0.32f),
            Camera.main.transform.position.y + offsetReleased.y
        );

        rb.MovePosition (newPos);
        offsetClicked = newPos - mousePos;
    } //Released
}

Above code working for mouse.
Thanks you

The Unity has its own touch library:

As far as I know, you’re going have to change all your script manually. I’m yet to do this in a quiz game for android, thanks to my laziness.