I don’t know what I’m doing wrong why my code won’t compile.

The general form of user control should be

while(true) {
  // some motor commands


The specific error you have is because you have an extra closing } (brace) that does not have a matching opening {

so remove the unnecessary while statement
match the braces in pairs.