Active learning: Top 5 searches Problem? Help someone?

<button class="output button">press</button>

<ul class="output ul"></ul>

<script>

//   const list = document.querySelector(".output ul");
  const searchInput = document.querySelector(".output input");
  const searchBtn = document.querySelector(".output button");

 
//   Uncaught TypeError: Cannot set properties of null (setting 'innerHTML') *Problem is here, I try it again and again for 2 days still I can't find solution please solve this*

  list.innerHTML = "";

  const myHistory = [];

  const MAX_HISTORY = 5;

   

//   Uncaught TypeError: Cannot set properties of null (setting 'onclick')  Then This Problem is created What is the solution above problem same here.

  searchBtn.onclick = () => {

    if (searchInput.value !== "") {

      myHistory.unshift(searchInput.value);

      list.innerHTML = "";

      for (const itemText of myHistory) {

        const listItem = document.createElement("li");

        litItem.textContent = itemText;

        list.appendChild(listItem);

      }

    }

  };

</script>