I have to configure 40 extensions in a limited time. Is it possible to configure one extension and copy it to remaining 39 extensions. 
Are you talking about provisioning the phones?
Unless you are using a GUI, it is trivial to clone extensions in Asterisk, itself.
If you are using a GUI, you need to state which, and this probably isn’t the best forum.