Not sure what you're trying to do exactly. Tell us, as specifically as you can, what you want to do. No one I know can help you much until you do.
Have you read and tried problem set 1 from the openacs problem sets? Do it... you should. Also, might be a good idea to read Phil and Alex's Guide to Web Publishing; another book you might look at is the Internet Application Workbook.
The tcl code you quoted can go in a (surprise!) whatever.tcl file, somewhere under the aolserver page root. The .adp file is for templated html; you can put tcl in there (google for "TCL For Web Nerds"), but as you will see in that book, it's not recommended. Aolserver also supports .html files.