1. Could mean either you have 24 total items (12 pens and 12 pencils) or you have 12 total pens and pencils. If you said this, someone would probably ask you to clarify. By the way, when I read it I automatically thought you had 6 pens and 6 pencils, but grammatically it is not clear.
2. This is incorrect, you would not use a comma unless you had more than 2 categories of items, for example: "I have twelve pens, pencils, and markers." Even then, it would be unclear whether you had twelve of each or twelve total.