There are lots of tutorials at
http://community.dur.ac.uk/john.evans/topas_workshop/topas_user_menu.htm. Along with the topas tech ref, they should give you an idea of the inp file structure. The error you have looks like a keyword in the wrong part of the file. E.g. Specifying a bkg outside an xdd section.