You are very lucky the motor has the female spline. That is much harder to make. Those motors have no front bearing! So, you have to make up a motor end plate, with bearings, mounting flange to the motor frame, and your output shaft.
I hope you have a lathe, too, to make the plate. You will pretty much need a dividing head to turn the shaft for the spline teeth, too.