Are you sure that both headlight bulbs are working ?
On my Kymco Super 8 (50 cc 4 stroke) is one of the headlight is blown i can get the other headlight to light for a moment but it will shut off after 2 seconds.
So first of all i would check and see if both the short and long light is not blown in both headlight bulbs.
Then remove the connectors and check for rust on the lightbulbs, light control box, voltage regulator, cdi and fuses.
If all the connections are fine i think you have a problem with the voltage regulator or the CDI.
On my scooter after 2 years of use the front light would just turn off... then later turn on by its self... later on and so on.
It might be the problem you are haveing but i was not able to trigger the error it just come and go.
Aynway the solution in my case was a new CDI.
The CDI needs to generate a pulse signal to the light control box and for some reason that signal was not made all the time. Without this signal the light control box (which control the front light) will shut off the front light.
Another Kymco Super 8 have reportet the exact same problem... also after about 2 years.
you can measure the signal from the CDI to the light control box if you like.
This is the light control box. The extra wire i connected to the CDI and on the wire it is suposed to get the pulse signal.
Here you can se how at one time the pulse signal is there.... and then... no signal without changing anything. The error is in the CDI in my cause.