Same for sed
sed -E 's&(.*M)( .*);( .*)$&<wpt\2\3>\n\t<time>\1</time>\n</wpt>&;
$!G;
s& = ([-.0-9]+)&="\1"&g' log.file
Or put it in the script-file
#!/bin/sed -E -fEf
s|(.*M)( .*);( .*)$|<wpt\2\3>\n\t<time>\1</time>\n</wpt>|
$!G
s| = ([-.0-9]+)|="\1"|g
And use it
sed -Ef script.file log.file
or if have made it executable by chmod +x ./script.file just
./script.file log.file