Well, after Googling, I found that it takes 1 seconds for the map to update.
Change the code Sleep(100) to Sleep(1100) and the map should update now as the camera is moving.
I don't think its the best solution, but at least it works.
If anyone else has a better solution please share