I think most people put one hand in front of the other for backhandspring on the beam. Practice it in easier places before you put it on the beam to get the hands part right - chalk on your hands/feet is a good idea when you practice it on floor, to check where your hands hit the floor.
If you feel you're going straight up/down, it could be because of timing, and you're not pushing back enough, and your arms aren't going back enough/aren't opening your shoulders. To know for sure, you should ask your coach what you're doing wrong; did they tell you? You could also take a video of it so that you can also look at what you're doing yourself along with your coach. Do you have one posted?