I want to modify all elements with the same query

I want to modify all elements that use the same query via a function. (The function is not changed.)

r is read, w is write, and a is write appended to existing content. When using this as get(query).r , .w , .a , I want to make all elements corresponding.

For example, if the class of 3 p tags is html, if you write get(“.html”).w(“hello”) in js, all tags with the class of 3 html should be changed to ‘hello’.

function get(id){
   if (id) {
      if (window === this) {
         return new get(id);
      }
      var query = document.querySelectorAll(id)
      for(var i = 0; i < query.length; i++) {
         this.e = query[i];
         return this;
      }
   } else {
      return "getError : The attribute and value of a tag such as id or class specified by get does not exist. ";
   }
  }
get.prototype = {
   r: function () {
      return this.e.innerText;
   },
   w: function (writing) {
      return this.e.innerText = writing;
   },
   a: function (writing) {
      return this.e.innerText = this.e.innerText += writing;
   }
};
<a href="#" class="test">js</a>
<p href="#" class="test">html</p>
<a href="#" class="test">test</a>
<script>
   get(".test").w("hello")
</script>