Unity C# Mobile Control Swipe Left Right

I am new to game development, i am trying to to change my code to mobile touch. 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? Here is the code.

privat bool canMove = true;

private void Update()
    {
        if (canMove)
        {
            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                newPos.x += 1.4f;
                transform.position = newPos;                
            }
            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                newPos.x -= 1.4f;
                transform.position = newPos;
                    
            }
        }
        if (Input.GetKeyDown(KeyCode.Space) && canMove)
        {
            ReleaseTheBall();
            canMove = false;
        }
        Vector2 clampPos = transform.position;
        clampPos.x = Mathf.Clamp(transform.position.x, -2.1f, 2.1f);
        transform.position = clampPos;
    }

https://stackoverflow.com/questions/31131525/unity3d-touch-swipe

@younes04
Hope this helps.