How to write code for downloading binaries from the particular url by using loop in chef cookbook

remote_file "#{java_install_dir}" do
source "#{java_url}"
user 'weblogic'
mode '0777'
action :create_if_missing
end

remote_file "#{oraclewl_install_dir}" do
source "#{oraclewl_url}"
user 'weblogic'
mode '0777'
action :create_if_missing
end

remote_file "#{rsp_install_dir}" do
source "#{rsp_url}"
user 'weblogic'
mode '0777'
action :create_if_missing
end

Welcome!
I suspect the main problem you are facing is that you have a pair of variables that you need to iterate over, instead of just one, which is easy and is used in many places:

list = ['one', 'two', 'three']
list.each do |item|
  resource item do
    // common properties to all items
  end
end

With a pair of distinct variables you will likely need to use something more complicated than an array to keep them together:

remote_files = {
  java: { install_dir: '...', url: 'http://...' },
  oraclewl: { install_dir: '...', url: 'http://...' },
  rsp: { install_dir: '...', url: 'http://...' },
}
remote_files.each_value do |software|
  remote_file software[:install_dir] do
    source software[:url]
    user 'weblogic'
    mode '0777'
    action :create_if_missing
  end
end

There are many ways to achieve this obviously... instead of a hash of hashes which can look kind of messy you could use chef attributes or some other data structure. The one thing that is important to remember when looping through resources is to always make sure each resource is named uniquely, which means the name must have one of your variables in it.

My recommendation is to not turn this code into a loop. As is, these three resources are easy to read and easy to debug when the time comes that one of them fails.

Thanks for your valuable answer, i will try this method in my code

As my product installation needs both java and response file so if one thing fails also i cant install my product