Okay… this tutorial example is not an extension example. It’s a snippet of code meant to run in the console by cut and paste. Or in one of the console+ editor extensions that has a “run” button.
To build a proper extension refer to the documentation for the SketchupExtension
class.