On my old Giant Sedona I ran the tail-light lead (bi-pole) along the inside centre of the mudguard, secured with normal clear adhesive tape (the matt-finish, write-on type). It stayed put through rain, dirt, mudguard-clogging mud and more for over seven years for me, and another six/seven with my son using it later on. When he eventually had to remove it for a new mudguard it was remarkable how VERY well affixed it still was
My solution is to run the rear lamp cable along the down tube, under the bottom bracket, along the left chainstay and then along the mudguard stay. Held on with zip ties.
I have used this method on my Thorn Nomad MkII and it has worked very well with zero attention for over seven years now.
Many methods will work - the glue-gun, Seamgrip, etc. But the tape under the mudguard is going to be the cheapest and easiest for a mudguard mount, and will last just fine. Easiest to redo as well if it ever does come off (unlikely).