I hope you aren’t just putting grated cheddar cheese directly into a pan to melt it, or directly onto your cooked noodles.
You need to make a roux or sauce first (which is equal parts flour and fat, ususally butter) that have been whisked constantly over low to medium heat for about 5 minutes. Melt the butter in a pan first, making sure not to burn it, then slowly whisk in the flour a little at a time. You will end up with a gooey ball that sort of has the consistency of peanut butter. Here is a picture of the roux to show you what it’s supposed to look like just before you add the warmed milk or cream.
Next, cream or milk, that has already been warmed (either in another pan or in the microwave) is slowly poured into the roux and mixed thoroughly. You will need to stir this mixture for another 10 or 15 minutes to make sure the flour loses it’s raw taste. At this point you can turn off the heat (or just have it on super-low) then add the shredded cheese into this mixture, stirring constantly. It should melt in easily and not be grainy.
Then this cheese sauce is ready to be poured over your noodles. Your mac and cheese can be eaten right away, as is, or it can be put into the oven in a casserole dish and baked (which I prefer).