Schematic: 1 Button and 1 Potentiometer Sketch
I will not write the code for you (as explained in my comment to your duplicate question), though I will point out some problems in your code and give hints how to solve them.
Mainly your program structure isn't correct. The first hint is to not look at real C/C++ code in the first step. Write down step by step, what the program should do. Here I'm doing this for you, as I understand your description:
Initialize everything (setup)
loop
  if button was pressed
    loop 10 times
      take analog reading and add it to the sum
      delay 10ms (for example) to keep the reading regularly spaced
    calculate average by dividing the sum of values through 10
    print average over serial

And from this pseudo code you would start to write the corresponding C/C++ code for the Arduino. For the &quot;Initialize everything&quot; you can reuse your current setup() function (assuming you already have a pulldown resistor on your button pin). What I wrote as &quot;loop&quot; would just be the loop() function. The &quot;if button was pressed&quot; will be a if(digitalRead(button_pin)). The 10 analog readings could be written with a for loop, adding the analog values to a local variable and delaying a bit to make the readings regularly spaced in a specific distance (you can change that to your liking. You could also delay way shorter with delayMicroseconds()).
And now some notes for your original code, that you should keep in mind for writing the new one:

You have the lines (I omitted some lines, that are irrelevant to my point here):
  statoPresenteBottone = digitalRead (BUTTON);
  while (statoPresenteBottone == HIGH) {
      statoPresenteBottone = LOW;
  }

Follow the logic here: We read the button state and save it in a variable. Then we loop while this variable is HIGH. But already in the first iteration of that loop we are setting the variable to LOW. That means the while loop will not loop. It will only run once. Also: If you want to check if the button is still HIGH, you actually need to read it. The variable statoPresenteBottone will not change automatically, when you press or release the button. You need to actually read the button pin with digitalRead(BUTTON). The variable is just a small space in memory, where you store data (like the last read state of the button). It is not connected to any hardware. That has to be done by the software.

You use an array for the analog values, though in this case you don't need that. For calculating the average it is enough to just add up the values and then divide by the number of measurements. The array is just not needed. And when removing the array, the variable counter and the complete array reset code becomes unnecessary and can be removed.

We cannot see your circuit, so please note, that you need a pulldown resistor on the pin, that you connected to the button. Otherwise you would have a floating pin, resulting in a randomly and often rapidly changing pin state. Often the people instead use the internal pullup resistor of the Arduino, by using pinMode(pin, INPUT_PULLUP) and connecting the button to ground instead of Vcc. Though that reverses the logic (LOW then means the button is pressed, HIGH means it is not pressed). It's up to you, want you want to use.

In the comments others pointed out button debouncing. That is an important issue, though for the above pseudocode structure that is not that important I think (this depends on how exactly you want the button to behave). So you should keep debouncing in mind. There are many tutorials about that online. I often suggest using the Bounce2 library, since it already handles the button debouncing for you and is fairly easy to use. Though - as said - I don't think that you really need it in this case.