Echoing @mdewey's comment, I wrote a fairly long response to a similar question a couple days ago, and I'd suggest you read through the response (the question is not exactly related, but the answer is). In particular, you should hopefully understand that you should never do a one-tail test after a two-tailed test, and a mdewey wrote, should generally just stay away from one-tailed tests.
How to interpret p-values of a summary output in R when testing for a one-sided hypothesis?
Once you've read that, to re-emphasize your point about
For example, Group A mean 48 and group B mean is 51, so we can say
group B is bigger than group A?
the approach for hypothesis testing generally is as follows: first you have a hypothesis that the means are different, and so the null hypothesis is that the means are the same (don't immediately impose that one specific mean is greater than the other, let the data explore that). Then you come up with a significance level, the standard is $\alpha = .05$. Then you collect data, and you test the null hypothesis. In this case, you'd probably do a two sample t.test. If the pvalue you get is lower than the $\alpha$ value, you then reject the null that they are the same, and can further conclude that the larger sample mean is indeed greater than the smaller one (significant at the $\alpha$ level). So yes, you check the means, but the order of things is really important.