The assembly of a bacterial-type flagellum, a motor complex composed of an extracellular helical protein filament coupled to a rotary motor embedded in the cell envelope which functions in cell motility.