The following example Bash script creates three locations {endash} London, Munich, Boston {endash} and assigns them to the Example Organization.
ORG="Example Organization"
LOCATIONS="London Munich Boston"
for LOC in ${LOCATIONS}
do
hammer location create --name "${LOC}"
hammer location add-organization --name "${LOC}" --organization "${ORG}"
done