Sometimes i see them in the same position . I think they both mean "for".. Please explain to me .. For example: 结力量来捍卫和平 ; 每到换李或者节假日的时候，各大商场都会举办一些活动来吸引顾客。
举办一些活动来吸引顾客 and 为吸引顾客而举办一些活动， are two different sentence structures, but the same meaning.
In 举办一些活动来吸引顾客, 来 can be translated as "to do", which means "for the purpose of".
举办一些活动来吸引顾客。= They have promotions to attract customers.
In 为吸引顾客而举办一些活动, 为 directly indicates the purpose of doing something.
为吸引顾客而举办一些活动。 = For the purpose of attracting more customers, they will have promotions today.
Yes, they both mean "for the purpose".
为。。。而。。。is a very useful sentence structure. For example,
爸爸为了养家而做两份工作。= My father works two jobs to support our family.