You are coughing up what I use a really technical term for,
gunk. Have you been ill? A lot of times, having
yellow sputum (the real name for it) as you been means the immune system has been working to fight off an infection. Normally it would be white, the yellow color is the indicator of that. But I know I can have that after I've been sick. So, had you had any other symptoms lately? Maybe you have bronchitis? https://www.webmd.