I want to insert upon creating a heading a PROPERTIES drawer. So far I have this

(defadvice org-insert-heading (after add-id-stuff activate)
  (template-myid))

(defun template-myid ()
  (insert "\n:PROPERTIES:\n:TIME: "
      (substring (format "%s" (format-time-string "%Y-%m-%dT%H:%M:%S")))
      "\n:VERTEX: "
      (substring (format "%s" (shell-command "uuidgen" t)))
      "\n:EDGES:  \n:END:"))

This is working -- sort of. My problem is the uuid is getting thrown around. The output looks like this

* Heading
:PROPERTIES:
:TIME: 2020-03-10T23:34:17
:VERTEX: 12836
:EDGES:  
:END:32bf9499-f9e2-49d9-b8e7-9edb40272411

Not sure how to make this behave.

LB