Can someone give me examples of how to use these correctly? Thank you
AためにB
A is a verb expressing an intentional action.
A and B are performed by the same person.
AようにB
A is non-intentional verb in the potential or nai-form, expressing a state, a condition, etc.
A and B can be performed either by the same or by different persons.
子供がべんきょうするように、あたらしいつくえを買ってあげました。
私はべんきょうするために、あたらしいつくえを買いました。
病気がなおるように、1日中ねていました。
病気をなおすために、1日中ねていました。