I applied all your suggestions sir but the predictions are same.They are prinitng spaces again and again.
printing code
def print_re(text,hiddens):
  
  print(text,end=' ')
  model.eval()
  with torch.no_grad():
        # Forwards pass
        tokens=[[char2int[text]]]
        #print(tokens)
        for i in range(0,10):
          output = model(tokens)
          #outputs=output.permute(0,2,1)
          #print(output.shape)
          hidden_output=output[0].squeeze(0).squeeze(0)
          
          prediction = hidden_output.cpu().numpy()
          #print(prediction)
          prediction = np.argsort(-prediction, axis=0)
          #print(prediction)
          print(int2char[prediction[0]],end='')
          
          tokens=[[prediction[0]]]
          #print(tokens)

Model code
 def forward(self, inputs, return_activations=False):
        self.batch_size = len(inputs)
    
        inputs = torch.LongTensor(inputs).to(self.device)
        inputs=inputs.transpose(0,1)
        
        # Get embeddings
        embedding_out = self.embedding(inputs)
        
        activations = self.apply_rnn(embedding_out)
        
        activations=activations.transpose(0,1) # output shape [batchSize,fixed_length,emb_length]
        activations=self.dropout(activations)
        activations=self.linear(activations)
        
        #out = torch.sigmoid(activations)

        # Put the output back in correct order
        return activations    

Thank you sir