Teleport CS0116 Error

So I’m trying to get it so that when a player walks up to a door they can press E and it will teleport them to the inside. But I’m getting the error of “Assets\EnterScript.cs(11,10): error CS0116: A namespace cannot directly contain members such as fields or methods”
Here’s my code:

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

public class EnterScript : MonoBehaviour
{
    public Transform TeleportTarget;
    public GameObject Player;

}
    void OnTriggerEnter()
    {
    if (Input.GetKeyDown(KeyCode.E))
        Player.transform.position = TeleportTarget.transform.position;
        Debug.Log("Ha Pasado");

    }

I’m not sure what’s going on.

error CS0116: A namespace cannot directly contain members …https://stackoverflow.com