The problem I am facing is that i used delay() function
Put a period after that part of the sentence. And, NEVER use delay again.
Look at the blink without delay example. It shows how to note when an event occurs (such as turning a relay on). It shows how to determine if now minus then exceeds some value (like how long the relay should be on. It shows how to execute some action when that happens.