How do I send data to HTML with Web Scraping technique?

I pulled a data from another site using the puppeteer command with JavaScript. When I run the code, the data comes to the terminal. However, I am building a website with HTML. And I cannot send this data to HTML. In fact, it gives me an error in the inspect section of the website I have made: “require(‘puppeteer’);” Uncaught ReferenceError: require is not defined.

const puppeteer = require('puppeteer');//The place that gives an error in the Inspect section.
async function scrapeProduct(url) {

    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    await page.goto(url);

    const [ element ] = await page.$x('//*[@id="cur-moon-percent"]');

    const text = await element.getProperty('textContent');
    const textValue = await text.jsonValue();

    document.getElementById('test').innerHTML = textValue();//Where I am trying to post the code to HTML.
    //To see if the code works, delete line 13 and replace it with Console.log(textValue);

    browser.close();
};
scrapeProduct('https://www.timeanddate.com/moon/phases/turkey/istanbul');
<!DOCTYPE html>
<html lang="en">
<body>
  <div id = "test"></div> <!--A rendered HTML to see if the data is gone.-->
</body>
</html>