Use Array#<< method
# search request
search = ["testOne", "testTwo"]
# Create base url for requests in loop
base_url = "http://example.com/"
# create an empty response array for loop below
response = []
search.each do |element|
response << "#{base_url}#{element}"
end
response # => ["http://example.com/testOne", "http://example.com/testTwo"]
response = "#{base_url}#{element}" means you are assigning in each iteration a new string object to the local variable response. In the last iteration response holds the string object "http://example.com/testTwo". Now response[0] means you are calling the method String#[]. So at index 0 of the string "http://example.com/testTwo", the character present is h, so your response[0] returning 'h'- which is expected as per your code.
The same code can be written in more sweet way :
# search request
search = ["testOne", "testTwo"]
# Create base url for requests in loop
base_url = "http://example.com/"
response = search.map {|element| base_url+element }
response # => ["http://example.com/testOne", "http://example.com/testTwo"]
or
response = search.map(&base_url.method(:+))
response # => ["http://example.com/testOne", "http://example.com/testTwo"]
or, as Michael Kohl pointed :
response = search.map { |s| "#{base_url}#{s}" }
response # => ["http://example.com/testOne", "http://example.com/testTwo"]