The problem lies in this line:
$rows[$count] = $rows[$count] . '<div class="col-sm-3">' . '<h4>'.strtoupper(get_the_title()[0]).'</h4>' .'<div class="post-title">'. '<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>' . '</div></div>';
As I understand your code correctly, it should append another column item to given row.
But it doesn’t do it – it overwrites the content of given row with current column.
So it should look like this (.=
instead of =
):
$rows[$count] .= $rows[$count] . '<div class="col-sm-3">' . '<h4>'.strtoupper(get_the_title()[0]).'</h4>' .'<div class="post-title">'. '<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>' . '</div></div>';
PS. You wrote that you want 3 columns, but in your code you divide by 4 – but maybe that’s just a typo.