You haven't yet understood something very very basic about arduino-programs:
function setup runs down a single time directly after power-on
after that function loop() is doing what its name says:
looping infinitely
This means any code that shall be executed once after pwer-on must be inside function
setup()
All code that shall be executed repeatedly must be inside function loop()
In your modification of my demo-code you left function loop() empty
you just left the comment inside. This comment is saying the same thing
For analysing what your code is really doing you should learn how to add serial printing to your code.
Adding serial printings is pretty easy. And having learned it will save you many many hours of time scratching your head why your code might not behave like you thought.
In general I recommend that you work through this tutorial
Take a look into this tutorial:
Arduino Programming Course
It is easy to understand and has a good mixture between explaining important concepts and example-codes to get you going. So give it a try and report your opinion about this tutorial.
There are basically two ways of learning programming
1 way which I do not recommend
stumbling over a detail like if-conditions require always a double-equal-sign for compairing
which you missed
has to be
// wrong single-equalsign if(buttonOld=0 && buttonNew== 1)
// right double-equal-sign if(buttonOld==0 && buttonNew== 1)`
if(buttonOld == 0 && buttonNew == 1)
stumbling again and again and again and again over some small detail
always waiting for an detail-answer
or way 2 which I recommend
working through a basic tutorial to learn the most important details and after that beeing able to start through with coding always based on a working code which you modify in small steps
to keep the space where the bug might be small for fast finding the bug.
learning how to use serial printing for analysing and if you can't conclude from the serial printing asking in the forum.
best regards Stefan