Pattern Double sided arrow solution and need suggestions


i have solved this problem using this method , is there a better solution available or is there any room for improvement in my code?