for(Account accNew : trigger.new)
Account Accold = trigger.oldmap.get(Accnew.Id);
If (accNew.Name != AccOld.name) {
accNew.addError ('Please do not change the account name');
}
You need curly braces. Your for loop in line 3 doesn't have braces so the scope is just line 4 and then you're out of the loop. So line 5 "thinks" you try to use undeclared variables.
Fix the braces and - since your indentation was lying to you - consider using something like Prettier / eslint for code formatting checks?