functino to set input/output redirection