How to escape echo for input tag?

Try this

function pen_post_sidebar_twitter() {
    printf( '<input type="text" name="twitter_handler" value="%s" placeholder="Twitter handler" /> <p class="description">Enter twitter handler without the @ sign.</p>', esc_attr( get_option( 'twitter_handler' ) ) );
}

Thanks