What is the purpose of flagella?

"a flagella" is incorrect, since it is a plural. Singular is "flagellum". They are hair-like appendages used for locomotion by single-cell animals.