I'm trying to understand the use of に as a particle to indicate the purpose of someone moving to another place to do something. For example, lets say that I want to say "I'm going home to eat dinner." Would this be written as:
私はひるごはんを食べますにうちへ行きます.
Or, if I wanted to say "I went to the library to study."
私はべんきょうしますに としょかんへ行きました
Are these correct? And does the particle に always come after the verb indicating what action is taken?
P.S: I checked the other topics relating to this, but none of them really cleared up the question I had. So, I'm sorry for posting something similar!