As you already mention Tasker, that should be possible with this alone – though the profile might be a little tricky (complex) to build. To find the needed conditions/actions, I've just added some graphics to my Tasker Resources:

Graph of available Tasker conditions and actions (as of 12/2014; click image for larger variant)
Actions to be used for this:
- Location › Get Location
(the fix data are stored in the relevant %LOC variables, see the Variables section of the userguide.)
- File › Write File
(If Append is checked, the text is added to the end of the file without changing the existing contents.)
- Location › Stop Location
(This is only necessary if the Keep Tracking parameter is checked in Get Location.) – but that's probably what you need to do
Basically, that outlines your task – just in the second bullet-point, you'll need to evaluate the %LOC
variable in a loop. Pseudo-Code: "While (not-reached-target) do: (evaluate %LOC
), (write file), (wait X seconds)". As the end-loop-condition is a, hm, condition, you'll probably need a slightly different approach:
- before the loop, set a custom variable, e.g.
%TRACKING_ACTIVE = 1
- have a profile firing on that variable. Conditions:
%TRACKING_ACTIVE ~ 1
- current location ~ target
- that profile's task then: Variables › Variable Set (
%TRACKING_ACTIVE = 0
)
- your "exit condition" for above while loop then is:
%TRACKING_ACTIVE ~ 0
So much about a "raw outline" to get you started. Have not the time to try it out myself and ship the ready-to-use profile, sorry :) And of course you've got to figure the format of the file – but hey, you're a dev :) AFAIK GPX should be easy, KML as well, as both are text-based (XML) formats.