Having lost of problem with my codes, Im quite new i tried chat gpt it didnt help

You have multiple instances of these functions

  • void loop()
  • void setup()
  • void factoryReset()

You must have exactly one setup() function and one loop() function.
You have two instances of void factoryReset(), there must be no more than one.
[Edit added text below here]
That error message is typically caused by not having matching pairs of curly brackets { and }, I couldn't spot a missing curly bracket. If you first sort out your code so that you only have one instance of each function then it might be easier to find.