make a button do something

what is the swift UI code to make a button do something, like go to another page of my app

A NavigationStack with NavigationLink is a good choice if you would like to navigate to a different view.

But it depends on what exactly you would like to do.
A NavigationSplitView could also be an option.

Have you already prepared something that you can post here?