Enemy Script Dilemma

I am an absolute beginner to coding and need some help with enemy movement. I am attempting to move the enemy from one transform position infinitely but this script I made only enables the movement to the first coordinate.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnemyCowMovement : MonoBehaviour {
public Rigidbody2D rb;
public float moveforce = 11f;
public float positionPoint = 20f;

// Use this for initialization
void Start () {
    if (transform.position.x > 12f)

        rb.velocity = Vector2.right * moveforce;

    if (transform.position.x > positionPoint) {
        rb.velocity = Vector2.left * moveforce;



I changed the second transform.position.x to < but it now fails to move. Any suggestions?

Because your code is in the Start() function. If you want to make it infinite you must write these codes on the Update() function.

Start only works once but Update is called every frame.