I guess your problem is, that NavMeshAgent is not found…?
I also guess you want to use Unity - Scripting API: NavMeshAgent , which appearantly is in the namespace UnityEngine.AI, so you have to add the line
using UnityEngine.AI;
At the top.
Note: Your IDE usually can help you with those things.
Your GetComponent is wrong. It should be:
GetComponent<NavMeshAgent>();