I am trying to create a drawing area with canvas. I am having trouble with making the lines look smooth when drawing curves and I also have changing line thickness in my algorit
Seems that you need to use some brushes in your canvas. It's hard to say what kind of brush exactly you need but there is many JS libraries that has already implement brush technology.
For example did you look at this libraries?
Laso in web you can find many brushes implemented in Mr. Doob Harmony project. For example stringy or Harmony-Brushes project on github.