Player movement help

Is there any script that moves my player to X place? Like i press A and it goes 3 blocks to Left, i press D and goes 3 blocks to the right, like this game. - YouTube

I’ve been doing my research but couldnt find anything.

public int currentPlayerPos; // index of current lane. 0 for center
public Vector2 playerPosLimits; // enter left/right position limits here
public float playerPos; // enter coordinates of lanes, left to right
public float posChangeSpeed;

void Update()
{
if(Input.GetKeyUp(KeyCode.D))
{
if(currentPlayerPos < playerPosLimits.y)
{
currentPlayerPos++;
}
}
if(Input.GetKeyUp(KeyCode.A))
{
if(currentPlayerPos > playerPosLimits.x)
{
currentPlayerPos--;
}
}
if(transform.position.x != playerPos[currentPlayerPos])
{
Vector3 newPosition = new Vector3(playerPos[currentPlayerPos], transform.position.y, transform.position.z);
transform.position = Vector3.MoveTowards(transform.position, newPosition, posChangeSpeed * Time.deltaTime);
}
}