change an objects position scripting

how do you change the x,y or z coordinates scripting? do you need to create an animation for that?

transform.position = new Vector3(1,1,1);
transform.position = target.position; // here your target should be of Transform type
void Update(){
transform.position+=transform.forward*Time.deltaTime*speed;
}

thx

Also might want to look at Transform.Translate()

ok i have found the answer,i think this script is right

using UnityEngine;
using System.Collections;

public class randomnumbertest1 : MonoBehaviour {

    int z = 100;

    // Use this for initialization
    void Start () {

    }
   
    // Update is called once per frame
    void Update () {
        int num = Random.Range (1, 101);
        if (num == 1) {
            z = z + 10;
            transform.position = new Vector3 (149, 13, z);
        }
           
    }
}