"Let's say I say no and he kept asking and I say yes and I was okay when I said yes as well too, is that coercion?"
Yes. Because not taking a no for an answer doesn't leave room for the other person to do anything but say yes eventually, don't you think? Consent is not enthusiastic and free when we are led to believe that the only way to get out of this uncomfortable situation is to say yes. Whatever narratives we create to cope with that fact, which usually tend to make the other person's desires more important than ours, or perhaps thinking we are okay with it when we say yes, DO NOT change the fact that the other person saw our no and decided to ignore it.
"Is it coercion if I was still not sure about it and I said no?"
The no is what you communicate to your partner. That and your body language of course. He couldn't have read your mind to know you were unsure, but if you know you were unsure, you most likely weren't giving enthusiastic consent, right?
The situation about the pillow doesn't sound like coercion to me. If he told you the reason he didn't want that particular position was the pain but when you brought up a possible solution he tried it and said that would be alright, sounds like he wasn't saying no to the sex, but to the position for a perhaps technical reason. However, his body language could be giving out the details I can't really know. If you are in doubt and feel comfortable with it, you could bring this up with him and ask him. In any case how he honestly felt and feels about it is what will determine whether you hurt him or not.
Here is a short story that could illustrate a little bit for you the kind of conversations that go into play whilst giving/withdrawing consent: Scarleteen Mix #6: Consenting and Other Sexual Communication
Here is a short article that could lead you to others if you are interested in reading more about consent: Quickies: Sexual Consent Basics
I would like to add that consent hasn't been a widespread topic until recently so it is possible that we will realize now about times when we didn't give consent and the other person disregarded it or even about times when ourselves disregarded other person's nonconsent. As human beings what is right to do is apologize and make ammends when we realize we have hurt someone else or when we feel we have betrayed ourselves doing something that doesn't live up to our moral values. But most importantly, we have to learn and educate ourselves about the right way to approach the situation in the future.