Your layout, where you are trying to echo your variable, is not your view.
Essentially, it can't be. Let me explain: Your layout is a global, well, layout. Something that's specific for IndexController's indexAction() is (/ should be) logically unavailable in the global layout, since your layout will not have this variable if you end up calling, say, FooController's barAction().
Your view would be at views/scripts/index/index.phtml - that's where you can use <?php echo $this->username; ?>
I haven't worked with variables in layouts yet, but this is what I'm gleaning from the documentation: If you want your layout to show a variable, try using $this->_helper->layout->username = "user1"
in your action, that should let you use echo $this->layout()->username
in the layout.
Be careful, though, if you do use layout variables, you also have to set them in each action. If you just want your indexAction() to show the username, you should try putting your echo into your view.