The first one is more grammatical. It separates both actions to make it clearer. The second one is a little bit informal. You can say "**He was driving texting on his phone**" people would understand you although it isn't correct. It would be better to say **"He was driving *while* texting on his phone"**.