Officials say militants on motorbikes attacked the girls and teachers as they walked to school in the southern city of Kandahar earlier this month .