The stool is formed as it passes thru the large intestine and the excess water is removed. If the parasites were attached on the outside then they most likely came from the lower intestine or bowel. Do these look line pinworms? Do a search for 'Enterobius vermicularis images'