Hi! Could somebody please explain me what is wrong?

addSpacer() is a method for ListWidget and WidgetStack. widget is an undefined variable as per the error message. Presumably you should be defining it as one of those list or stack options prior to use in this way.

See the in app Scriptable docs for details on those classes.