How to turn turn the 5V pin output signal into 9V and drive a motor?

With an H-bridge you don't need another transistor. The H-bridge can be driven by 5V and powered by higher voltage.