You can use element.setProperty('propertyName', propertyValue) to set transform properties.
For example:
doc.getElement("kotak").setProperty('rotateX', output);
For more information about the setProperty method, please see this topic: API documentation questions
However, instead of setting properties using JavaScript like this, you can create a timeline with animations (e.g. rotateX from 0 to 360) but don’t play the timeline. After that, you use the script to scrub the timeline as in the control-animations sample. Doing this way you can control any property with the same script.
Regards