From your 'document.write' and 'script' lines it would appear that you are trying to run this code in the browser... if so, you won't be able to do what you want to do.
server.createobject would be for VBScript/ASP usage on the server itself. (the 'server' object is an ASP object and would not be available in VBScript in the client browser)
To do what you want (if I am reading between the lines correctly) you would need to create an ASP script (or similar) on your server to grab the output from 'whoami' and return/output it. You could call it from your client-side page via javascript/AJAX.
(Keep in mind that running a command using 'WScript.Shell' carries its own set of security challenges, as well)