Your second sentence is incorrect. I'm not sure how you intended it, but it parses in two ways, neither of which is correct:
Hand this [in the most convenient time for you].
If you parse it this way, you have replaced the phrasal verb "hand in" with the simple verb "hand". The verb "hand" is transitive, which means it always has a direct object, but in this parsing of the sentence, there's no direct object, so the grammar is bad.
[Hand this in] [the most convenient time for you].
With this parsing, you still have the correct phrasal verb "hand in", but now it's followed by a noun phrase rather than a prepositional phrase or adverbial to describe how or where to hand it in. A bare noun phrase cannot follow a clause so it's bad grammar.
If you start with this second parsing, and add the preposition "at" in the place where Grammarly suggests, "at the most convenient time for you" becomes a prepositional phrase that has good grammar and meaning.