Hello, For both of those examples you will use "to". You could use "for the purpose of", but that sounds to wordy. Basically "to", in the way you are using it, means "for the purpose of".
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.
everlastinghope I bought aYes. Use this one.psychologicalpsychology book to learn about people's behaviour and personality
everlastinghopeI went to the changing room to change my clothesYes. Use this one.