Millis() not working

This is initialization of local variable and it is performed just once.
Variables timeEnd, timeBegin are global, zeroed by default.
Try this:

unsigned long duration;
  duration = timeEnd - timeBegin;