Your script does not handle stderr, stdout, and SIGINT correctly, probably more.
With enough work at least some of them could be fixed, maybe even all. But why reinventing the wheel if timeout is contained in coreutils and available on nearly every Linux machine?