I do not read analog input with millis function

Appreciated!

You might buy a book about C++ and/or use one of the tutorials on C++

e.g.

https://www.learncpp.com/

One of the basic issues in programming is to avoid code replications wherever possible. It reduces debugging and maintenance effort! (Not to talk about the satisfaction factor...).

If you like you may start with this part

      Wire.beginTransmission(0x50);    
      Wire.write(highByte(indirizzo));
      Wire.write(lowByte(indirizzo));    
      Wire.write(byte(byteUno));    
      Wire.endTransmission();

and create a function that can be called with specific parameters...?!?

Good luck and have fun!
ec2021

(Don't hesitate to ask further questions if required.)

P.S.: I forgot to mention that using a while loop as done here is not a preferred solution. The reason is that it blocks loop() for some time. If you want to add further functionality like reading data from the serial port or a button status you might have to add it in the while loop and in loop() and any further blocking function.

To avoid this one would always prefer a state machine. For an interesting tutorial about this topic feel free to follow this link

https://forum.arduino.cc/t/yet-another-finite-state-machine-introduction/1198997