Help with WordPress function inside a shortcode

It looks like you’re using a php tag within a php tag. I’d try something more like this…

<?php 
    echo do_shortcode('[button type="square" color="black" size="small"] Posted by '.get_the_author().' [/button]');
?>

or something like this…

<?php 
    $shortcode="[button type="square" color="black" size="small"] Posted by ".get_the_author().' [/button]';
    echo "do_shortcode('$shortcode')";
?>