Welcome to the forum!
You might want to give more details about what you’re trying to accomplish, as opposed to a detailed technical question. The Anvil tutorials cover handling the click event on a button, so I’m assuming you’re trying to accomplish something more than just that. The context around what you’re trying to do helps people offer better advice.
Here’s a description of how to ask a question in a way that’s designed to get useful feedback: How to ask a good question
For what it’s worth, your code sample has a number of issues, but I wouldn’t even attempt to offer any fixes without knowing the context.