How can I add more code to this?

To insert new code you need to break php code and past your new html+/-php code. But pay attention that after passing all will have correct syntax.

Your question should be made like this:

<?php $my_query = new WP_Query( "cat=11&posts_per_page=1" );
if ( $my_query->have_posts() ) { 
    while ( $my_query->have_posts() ) { 
        $my_query->the_post(); ?>

        <h2><a href="https://wordpress.stackexchange.com/questions/53008/<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
        <div class="postdetails">
            Written by <strong><?php the_author(); ?></strong>
            <?php the_time ('j F, Y'); ?>
            Posted in: <strong><?php the_category(', '); ?></strong>
            <?php the_tags(); ?>
        </div>

        <?php the_excerpt();
    }
}
wp_reset_postdata(); ?>