I have this node script where it does an API call and receive the response. So what I want to do is to make a UI that controls when the script works. For example when I click a button (HTML) the script starts and then prints the response into a textbox. Is there any way to do this?
You need something to render the HTML and send a message to your Node.js program and your Node.js program needs some way to understand that message.
The most common approach would be to write a web service (usually using Express.js unless you are using React/Vue in which case Next.js/Nuxt become more interesting) and then communicate with it using Ajax (typically the fetch API). Other options would be form submissions or web sockets.
Less common would be to use a framework such as Electron.js or OpenFin to run a desktop application with an embedded HTML renderer. They then have their own APIs to communicate with the Node.js portion of the application.