The audio element you originally created loses scope when the function is finished. You'll need to access the audio element that's in the DOM.
audio.setAttribute("id", "myAudioClip")
var div = document.getElementById(id);
div.appendChild(audio);
var audioElement = document.getElementById("myAudioClip");
audioElement.load();
audioElement.play();