CS1022 I'm getting an error on 2D movement script

Assets\movement.cs(22,1): error CS1022: Type or namespace definition, or end-of-file expected

I don’t know what to do.
I just returned to Unity, so my code is probably wrong or something, anyways here is my code.

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

public class Movement : MonoBehaviour
{
    public float speed;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        public float x = Input.GetAxis("Horizontal");
        public float y = Input.GetAxis("Vertical");

        transform.position += new Vector3(x * speed,y * speed,0);
    }
}

Hey and welcome.

in general this is not really a unity-question. The issue you have is that you defined local variables inside of Update and gave those an access modifier (public) → this is not allowed and leads to the error.

So what you need here:

     void Update()
     {
         float x = Input.GetAxis("Horizontal");
         float y = Input.GetAxis("Vertical");
 
         transform.position += new Vector3(x * speed,y * speed,0);
     }

and it should work