It's pretty clear that your doctor wants you to exercise. Although recommendations regarding the amount and intensity may vary slightly, most of us simply do not exercise enough. How does exercise (or a lack thereof) affect our sleep?
According to guidelines for better sleep, it is recommended that you exercise every day, but you should avoid doing it in the four hours before bedtime. Unfortunately, for many of us, if we don't exercise in the four hours before bedtime we may not have time to exercise at all.
Staying active and physically fit is an excellent way to ensure a good night's sleep. If you are prone to insomnia, however, you may wish to avoid evening exercise routines. Your body may be too revved up after a strenuous workout to fall asleep hours later. If this is the case, perhaps you are someone who needs to exercise first thing in the morning. If it makes no difference on how long it takes you to fall asleep, you needn't worry about it.