Welcome to the forum, and to the wonderful world of model trains!
It sounds like the locomotive may be bad. A little more information is needed. What brand set is it, and what is the catalog number of the set? Is the loco a steam engine or a diesel? Does the light flash with just the locomotive on the track alone? Is the power off when you put the engine on the track?
With these answers we can help you better.
Larry