You can use the .clone() method to create a new instance to append to the DOM, since your current code just refers to the same instance twice.
$(function(){
var $foo = $("HI");
var $foo2 = foo.clone();
$("#a").append($foo);
$("#b").append($foo2);
});