"How do you do, sir?"
"ne yapıyorsunuz": what are you doing?
so it is not a translation of "how do you do?". "How do yo do?" [which would literally be "nasıl yaparsınız?" in Turkish] is a kind way of asking "how are you?" in english.
"how are you?" "how do you do?"
Does the meaning of these two sentences?
Yes, "How do you do" is closer to "Hello" in usage, than to "How are you".
The correct answer to "How do you do" is "How do you do". It is used as a formal "Hello". Personally, I would translate it to "Merhaba". Because both parties say the same thing. It is simply a greeting.
With "How are you", you can answer with the same "How are you". Or you can describe your health situation. "I'm fine, thanks". There are countless variations. So it is closer in usage to "Nasılsın(ız)".
As far as I know, "How do you do" is very formal, and very English. They don't really use it in American English.
About the origin of "How do you do": http://www.phrases.org.uk/meanings/how-do-you-do.html
I am English and have never once said or heard "how do you do" in real life. It's archaic
first of all, why "ne yapıyorsunuz" wrong is explained above. furthermore, you can never ever talk to someone you say sir/beyefendi in "sen" form, you have to use the "siz" form.