To the head section, you can use headScript()
method like your code.
To the end of the body, you can use InlineScript()
method like this:
$this->view->InlineScript()->appendFile($this->view->baseUrl() .'/js/myfile.js');
and at the end of your layout add:
<?php
echo $this->InlineScript();
?>
To add script in the bootstrap, you can do somehing like this:
protected function _initView()
{
$options = $this->getOptions();
if (isset($options['resources']['view'])){
$view = new Zend_View($options['resources']['view']);
}
else{
$view = new Zend_View;
}
$view->InlineScript()->appendFile(...);
}