All the code needs to be inside the MonoBehaviour { } brackets,or els it wont work,smartypants. its the same as HTML. it all needs to be inside the main block.
thats how it works.
your code was outside of the MonoBehaviour {} brackets.
as this was a simple cut and paste fix , i did the fixing for you.
(if its still relevant)
using UnityEngine;
using System.Collections;
public class EnemyAI : MonoBehaviour {
public Transform target;
public int moveSpeed;
public int rotationSpeed;
You can’t use C# like that; it must be in a class that extends MonoBehaviour (plus you need to import the UnityEngine namespace). If you want simpler coding that doesn’t require that kind of boilerplate code, you’d be better off with Unityscript.