First you define the errorSchema within the collection.
Then you set it as a global variable with the same variable name (not good practice, keep the variable names separate) and you also convert it to a string. If you have variables with the same names, then scope becomes an issue. Just name them uniquely. Much easier to track what is going on.
In your test, you then parse it back to a JavaScript object. Why not just leave it as a JavaScript object when you set the global variable. Then you don’t have to use stringify or parse.
I don’t get what you are doing with “verifyErrorSchema”. It looks like you are trying to set another global variable using the test as a function. (Are you sure you want this to be global variables - available to all collections in Postman).
Just try this within the tests tab for a single request first. Get it working there, before you move it to the collection level and start using global variables (although pretty sure it should be a collection variable instead).